Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 723a2311 authored by Rashika Kheria's avatar Rashika Kheria Committed by Greg Kroah-Hartman
Browse files

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: default avatarRashika Kheria <rashika.kheria@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 4759e824
Loading
Loading
Loading
Loading
+8 −9
Original line number Original line Diff line number Diff line
@@ -1932,23 +1932,22 @@ static void dwc2_hc_n_intr(struct dwc2_hsotg *hsotg, int chnum)


	chan = hsotg->hc_ptr_array[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));
	hcint = readl(hsotg->regs + HCINT(chnum));
	hcintmsk = readl(hsotg->regs + HCINTMSK(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) {
	if (!chan) {
		dev_err(hsotg->dev, "## hc_ptr_array for channel is NULL ##\n");
		dev_err(hsotg->dev, "## hc_ptr_array for channel is NULL ##\n");
		writel(hcint, hsotg->regs + HCINT(chnum));
		writel(hcint, hsotg->regs + HCINT(chnum));
		return;
		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));
	writel(hcint, hsotg->regs + HCINT(chnum));
	chan->hcint = hcint;
	chan->hcint = hcint;
	hcint &= hcintmsk;
	hcint &= hcintmsk;