aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaro Koskinen <aaro.koskinen@iki.fi>2013-12-21 13:37:37 -0500
committerFelipe Balbi <balbi@ti.com>2013-12-23 11:14:40 -0500
commit8b42a746e8703c271df3e7f1f5bf5f8f59773d23 (patch)
tree96489433d85ed9ad655bdc2419f0cc8516bda47b
parent80f46d5dcb0af46f325c897392baef4911f401b7 (diff)
usb: phy: isp1301-omap: fix smatch warnings
phy-isp1301-omap produces the following smatch warnings: drivers/usb/phy/phy-isp1301-omap.c:1280 isp1301_set_host() warn: variable dereferenced before check 'otg' (see line 1278) drivers/usb/phy/phy-isp1301-omap.c:1336 isp1301_set_peripheral() warn: variable dereferenced before check 'otg' (see line 1334) drivers/usb/phy/phy-isp1301-omap.c:1417 isp1301_start_srp() warn: variable dereferenced before check 'otg' (see line 1414) drivers/usb/phy/phy-isp1301-omap.c:1445 isp1301_start_hnp() warn: variable dereferenced before check 'otg' (see line 1442) Fix by deleting bogus NULL pointer checks. The USB framework will always call us with a valid OTG pointer. Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi> Signed-off-by: Felipe Balbi <balbi@ti.com>
-rw-r--r--drivers/usb/phy/phy-isp1301-omap.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/drivers/usb/phy/phy-isp1301-omap.c b/drivers/usb/phy/phy-isp1301-omap.c
index d3a5160e4cc7..6e146d723b37 100644
--- a/drivers/usb/phy/phy-isp1301-omap.c
+++ b/drivers/usb/phy/phy-isp1301-omap.c
@@ -1277,7 +1277,7 @@ isp1301_set_host(struct usb_otg *otg, struct usb_bus *host)
1277{ 1277{
1278 struct isp1301 *isp = container_of(otg->phy, struct isp1301, phy); 1278 struct isp1301 *isp = container_of(otg->phy, struct isp1301, phy);
1279 1279
1280 if (!otg || isp != the_transceiver) 1280 if (isp != the_transceiver)
1281 return -ENODEV; 1281 return -ENODEV;
1282 1282
1283 if (!host) { 1283 if (!host) {
@@ -1333,7 +1333,7 @@ isp1301_set_peripheral(struct usb_otg *otg, struct usb_gadget *gadget)
1333{ 1333{
1334 struct isp1301 *isp = container_of(otg->phy, struct isp1301, phy); 1334 struct isp1301 *isp = container_of(otg->phy, struct isp1301, phy);
1335 1335
1336 if (!otg || isp != the_transceiver) 1336 if (isp != the_transceiver)
1337 return -ENODEV; 1337 return -ENODEV;
1338 1338
1339 if (!gadget) { 1339 if (!gadget) {
@@ -1414,8 +1414,7 @@ isp1301_start_srp(struct usb_otg *otg)
1414 struct isp1301 *isp = container_of(otg->phy, struct isp1301, phy); 1414 struct isp1301 *isp = container_of(otg->phy, struct isp1301, phy);
1415 u32 otg_ctrl; 1415 u32 otg_ctrl;
1416 1416
1417 if (!otg || isp != the_transceiver 1417 if (isp != the_transceiver || isp->phy.state != OTG_STATE_B_IDLE)
1418 || isp->phy.state != OTG_STATE_B_IDLE)
1419 return -ENODEV; 1418 return -ENODEV;
1420 1419
1421 otg_ctrl = omap_readl(OTG_CTRL); 1420 otg_ctrl = omap_readl(OTG_CTRL);
@@ -1442,7 +1441,7 @@ isp1301_start_hnp(struct usb_otg *otg)
1442 struct isp1301 *isp = container_of(otg->phy, struct isp1301, phy); 1441 struct isp1301 *isp = container_of(otg->phy, struct isp1301, phy);
1443 u32 l; 1442 u32 l;
1444 1443
1445 if (!otg || isp != the_transceiver) 1444 if (isp != the_transceiver)
1446 return -ENODEV; 1445 return -ENODEV;
1447 if (otg->default_a && (otg->host == NULL || !otg->host->b_hnp_enable)) 1446 if (otg->default_a && (otg->host == NULL || !otg->host->b_hnp_enable))
1448 return -ENOTCONN; 1447 return -ENOTCONN;