Commit 2904a33c authored by David Dueck's avatar David Dueck Committed by Greg Kroah-Hartman

usb: phy: am335x-control: check return value of bus_find_device

commit d0f347d6 upstream.

This fixes a potential null pointer dereference.

Fixes: d4332013 ("driver core: dev_get_drvdata: Don't check for NULL dev")
Acked-by: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: default avatarDavid Dueck <davidcdueck@googlemail.com>
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 3a72c7f1
...@@ -126,6 +126,9 @@ struct phy_control *am335x_get_phy_control(struct device *dev) ...@@ -126,6 +126,9 @@ struct phy_control *am335x_get_phy_control(struct device *dev)
return NULL; return NULL;
dev = bus_find_device(&platform_bus_type, NULL, node, match); dev = bus_find_device(&platform_bus_type, NULL, node, match);
if (!dev)
return NULL;
ctrl_usb = dev_get_drvdata(dev); ctrl_usb = dev_get_drvdata(dev);
if (!ctrl_usb) if (!ctrl_usb)
return NULL; return NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment