Staging: dwc2: Fix variable dereferenced before check
authorRashika Kheria <rashika.kheria@gmail.com>
Tue, 29 Oct 2013 22:46:55 +0000 (04:16 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 30 Oct 2013 16:24:39 +0000 (09:24 -0700)
This patch fixes the following smatch warning in hcd_intr.c-
drivers/staging/dwc2/hcd_intr.c:1946 dwc2_hc_n_intr() warn: variable dereferenced before check 'chan' (see line 1936)

Signed-off-by: Rashika Kheria <rashika.kheria@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/dwc2/hcd_intr.c

index cad433a75abae4cb91be0b5ce4271c5ad11286b7..dda18540f5a7f306b3b003cd9b47f7e0b7c87c05 100644 (file)
@@ -1932,23 +1932,22 @@ static void dwc2_hc_n_intr(struct dwc2_hsotg *hsotg, int chnum)
 
        chan = hsotg->hc_ptr_array[chnum];
 
-       if (dbg_hc(chan))
-               dev_vdbg(hsotg->dev, "--Host Channel Interrupt--, Channel %d\n",
-                        chnum);
-
        hcint = readl(hsotg->regs + HCINT(chnum));
        hcintmsk = readl(hsotg->regs + HCINTMSK(chnum));
-       if (dbg_hc(chan))
-               dev_vdbg(hsotg->dev,
-                        "  hcint 0x%08x, hcintmsk 0x%08x, hcint&hcintmsk 0x%08x\n",
-                        hcint, hcintmsk, hcint & hcintmsk);
-
        if (!chan) {
                dev_err(hsotg->dev, "## hc_ptr_array for channel is NULL ##\n");
                writel(hcint, hsotg->regs + HCINT(chnum));
                return;
        }
 
+       if (dbg_hc(chan)) {
+               dev_vdbg(hsotg->dev, "--Host Channel Interrupt--, Channel %d\n",
+                        chnum);
+               dev_vdbg(hsotg->dev,
+                        "  hcint 0x%08x, hcintmsk 0x%08x, hcint&hcintmsk 0x%08x\n",
+                        hcint, hcintmsk, hcint & hcintmsk);
+       }
+
        writel(hcint, hsotg->regs + HCINT(chnum));
        chan->hcint = hcint;
        hcint &= hcintmsk;