From 723a2311fa4a3cf64ee7b435ba64f797ee2a568a Mon Sep 17 00:00:00 2001 From: Rashika Kheria Date: Wed, 30 Oct 2013 04:16:55 +0530 Subject: [PATCH] Staging: dwc2: Fix variable dereferenced before check 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 Signed-off-by: Greg Kroah-Hartman --- drivers/staging/dwc2/hcd_intr.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/drivers/staging/dwc2/hcd_intr.c b/drivers/staging/dwc2/hcd_intr.c index cad433a75aba..dda18540f5a7 100644 --- a/drivers/staging/dwc2/hcd_intr.c +++ b/drivers/staging/dwc2/hcd_intr.c @@ -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;