]> git.baikalelectronics.ru Git - uboot.git/commit
usb: dwc3-generic: Return early when there is no child node
authorJonas Karlman <jonas@kwiboo.se>
Sun, 30 Jul 2023 22:59:55 +0000 (22:59 +0000)
committerKever Yang <kever.yang@rock-chips.com>
Mon, 31 Jul 2023 06:40:38 +0000 (14:40 +0800)
commit14feefd848809a40fa9a387449ec2fcfad378767
tree101a03e373518bac2acfae94392103aa05c00109
parentf6be8f0976c2c27e4c5fdbe053946744679f8bb3
usb: dwc3-generic: Return early when there is no child node

The current error check for device_find_first_child is not working as
expected, the documentation for device_find_first_child mention:

  @devp: Returns first child device, or NULL if none
  Return: 0

Change to return early when there is no child node to avoid any possible
null pointer dereference.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Marek Vasut <marex@denx.de>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
drivers/usb/dwc3/dwc3-generic.c