brcm80211: fmac: fix a couple checking after dereference bugs
authorDan Carpenter <dan.carpenter@oracle.com>
Fri, 24 Feb 2012 06:22:27 +0000 (09:22 +0300)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 27 Feb 2012 19:06:41 +0000 (14:06 -0500)
There were two dereferencing before checking for NULL static checker
complaints in this new file.  The list cursor is never NULL so that
check can be removed.  I moved the other dereference after the check.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/brcm80211/brcmfmac/usb.c

index 934ed782620c7a2b5f3c1d6bc7f8f832ceadf03e..7c54d1db4a44432f9e6bf744dc6c6d1bec7946c3 100644 (file)
@@ -482,7 +482,7 @@ static void brcmf_usb_free_q(struct list_head *q, bool pending)
        struct brcmf_usbreq *req, *next;
        int i = 0;
        list_for_each_entry_safe(req, next, q, list) {
-               if (!req || !req->urb) {
+               if (!req->urb) {
                        brcmf_dbg(ERROR, "bad req\n");
                        break;
                }
@@ -712,12 +712,12 @@ static int brcmf_usb_up(struct device *dev)
        struct brcmf_usbdev_info *devinfo = brcmf_usb_get_businfo(dev);
        u16 ifnum;
 
-       if (devinfo->bus_pub.state == BCMFMAC_USB_STATE_UP)
-               return 0;
-
        if (devinfo == NULL)
                return -EINVAL;
 
+       if (devinfo->bus_pub.state == BCMFMAC_USB_STATE_UP)
+               return 0;
+
        /* If the USB/HSIC bus in sleep state, wake it up */
        if (devinfo->suspend_state == USBOS_SUSPEND_STATE_SUSPENDED) {
                if (brcmf_usb_pnp(devinfo, BCMFMAC_USB_PNP_RESUME) != 0) {
This page took 0.025528 seconds and 5 git commands to generate.