[PATCH 2/5] usb: dwc3-generic: Return early when there is no child node
Jonas Karlman
jonas at kwiboo.se
Thu Jun 1 13:28:35 CEST 2023
Hi Jagan,
On 2023-06-01 06:10, Jagan Teki wrote:
> On Tue, May 30, 2023 at 3:56 PM Jonas Karlman <jonas at kwiboo.se> wrote:
>>
>> The call to device_find_first_child always return 0, change to return
>> early when there is no child node.
>
> Can you explain a little more about this? Maybe adding device-tree
> pipeline will give a better understanding of the issue.
The docs for device_find_first_child mention:
@devp: Returns first child device, or NULL if none
Return: 0
And the function does exactly this, always return 0.
So, the current check for return value of this call is unnecessary.
The following possible call to dwc3_glue_clk_init or dwc3_glue_reset_init
may trigger a null pointer dereference further down the call chain.
Looking closer this patch may have been more related to my rk3328
testing, where usb at ff600000 in rk3328.dtsi is missing child nodes and
resets prop.
For RK3568 this patch should not be needed, however it still fixes a
possible null pointer dereference issue.
Regards,
Jonas
>
> Jagan.
More information about the U-Boot
mailing list