Re: [RFC PATCH 5/7] bus: stm32_sys_bus: add support for STM32MP15 and STM32MP13 system bus
From: Krzysztof Kozlowski
Date: Thu Dec 22 2022 - 10:19:21 EST
On 22/12/2022 15:30, Gatien CHEVALLIER wrote:
>>
>>> + if (IS_ERR(mmio))
>>> + return PTR_ERR(mmio);
>>> +
>>> + pdata->sys_bus_base = mmio;
>>> +
>>> + mdata = (struct stm32_sys_bus_match_data *)of_device_get_match_data(&pdev->dev);
>>
>> Why do you need the cast?
>
> I do not :) TBH, mdata is not useful at all. Changing to directly assign
> to pdata->pconf, that is now const there is no reason to modify it.
mdata should be const and then no need for cast.
>
>>
>>> + if (!mdata)
>>
>> Can you explain the case when this can actually happen? If it can, you
>> have bug in ID table.
>
> No I cannot as the driver is probed. It is only a sanity check, I can
> remove it for V3. However the function can return NULL... Would you
> prefer an explicit check on NULL or a simple removal?
I propose to drop it. This simply cannot happen.
>
>>
>>> + return -EINVAL;
>>> +
Best regards,
Krzysztof