diff options
author | David Dueck <davidcdueck@googlemail.com> | 2015-02-08 10:29:30 -0500 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2015-03-10 17:28:44 -0400 |
commit | d0f347d62814ec0f599a05c61c5619d5e999e4ae (patch) | |
tree | f90e46fd64c0f1419d6ead467cf59b18171aaeee /drivers/usb | |
parent | 509d612b2fc4b66a58f1af762ac69829ed11c0ce (diff) |
usb: phy: am335x-control: check return value of bus_find_device
This fixes a potential null pointer dereference.
Cc: <stable@vger.kernel.org> # v3.16+
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>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/phy/phy-am335x-control.c | 3 |
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) | |||
126 | return NULL; | 126 | return NULL; |
127 | 127 | ||
128 | dev = bus_find_device(&platform_bus_type, NULL, node, match); | 128 | dev = bus_find_device(&platform_bus_type, NULL, node, match); |
129 | if (!dev) | ||
130 | return NULL; | ||
131 | |||
129 | ctrl_usb = dev_get_drvdata(dev); | 132 | ctrl_usb = dev_get_drvdata(dev); |
130 | if (!ctrl_usb) | 133 | if (!ctrl_usb) |
131 | return NULL; | 134 | return NULL; |