]> Pileus Git - ~andy/linux/commitdiff
usb: phy: isp1301-omap: fix smatch warnings
authorAaro Koskinen <aaro.koskinen@iki.fi>
Sat, 21 Dec 2013 18:37:37 +0000 (20:37 +0200)
committerFelipe Balbi <balbi@ti.com>
Mon, 23 Dec 2013 16:14:40 +0000 (10:14 -0600)
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>
drivers/usb/phy/phy-isp1301-omap.c

index d3a5160e4cc794f6e1ead500822d20157b06abd1..6e146d723b37e06914117f066461e3b6f4c86e91 100644 (file)
@@ -1277,7 +1277,7 @@ isp1301_set_host(struct usb_otg *otg, struct usb_bus *host)
 {
        struct isp1301  *isp = container_of(otg->phy, struct isp1301, phy);
 
-       if (!otg || isp != the_transceiver)
+       if (isp != the_transceiver)
                return -ENODEV;
 
        if (!host) {
@@ -1333,7 +1333,7 @@ isp1301_set_peripheral(struct usb_otg *otg, struct usb_gadget *gadget)
 {
        struct isp1301  *isp = container_of(otg->phy, struct isp1301, phy);
 
-       if (!otg || isp != the_transceiver)
+       if (isp != the_transceiver)
                return -ENODEV;
 
        if (!gadget) {
@@ -1414,8 +1414,7 @@ isp1301_start_srp(struct usb_otg *otg)
        struct isp1301  *isp = container_of(otg->phy, struct isp1301, phy);
        u32             otg_ctrl;
 
-       if (!otg || isp != the_transceiver
-                       || isp->phy.state != OTG_STATE_B_IDLE)
+       if (isp != the_transceiver || isp->phy.state != OTG_STATE_B_IDLE)
                return -ENODEV;
 
        otg_ctrl = omap_readl(OTG_CTRL);
@@ -1442,7 +1441,7 @@ isp1301_start_hnp(struct usb_otg *otg)
        struct isp1301  *isp = container_of(otg->phy, struct isp1301, phy);
        u32 l;
 
-       if (!otg || isp != the_transceiver)
+       if (isp != the_transceiver)
                return -ENODEV;
        if (otg->default_a && (otg->host == NULL || !otg->host->b_hnp_enable))
                return -ENOTCONN;