summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Dueck <davidcdueck@googlemail.com>2015-02-08 16:29:30 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-04-13 14:03:53 +0200
commit2904a33c4b08922cdae642a528ef4df2487b56da (patch)
tree64d473491271c25f4b30201af7b06cd0b5a50e4d
parent3a72c7f1bc0d055493ade4ab4d017309268d526c (diff)
usb: phy: am335x-control: check return value of bus_find_device
commit d0f347d62814ec0f599a05c61c5619d5e999e4ae upstream. This fixes a potential null pointer dereference. Fixes: d4332013919a ("driver core: dev_get_drvdata: Don't check for NULL dev") Acked-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: David Dueck <davidcdueck@googlemail.com> Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/usb/phy/phy-am335x-control.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/usb/phy/phy-am335x-control.c b/drivers/usb/phy/phy-am335x-control.c
index 403fab772724..7b3035ff9434 100644
--- a/drivers/usb/phy/phy-am335x-control.c
+++ b/drivers/usb/phy/phy-am335x-control.c
@@ -126,6 +126,9 @@ struct phy_control *am335x_get_phy_control(struct device *dev)
return NULL;
dev = bus_find_device(&platform_bus_type, NULL, node, match);
+ if (!dev)
+ return NULL;
+
ctrl_usb = dev_get_drvdata(dev);
if (!ctrl_usb)
return NULL;