public inbox for linux-usb@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@linaro.org>
To: oe-kbuild@lists.linux.dev,
	Niklas Neronin <niklas.neronin@linux.intel.com>,
	mathias.nyman@linux.intel.com
Cc: lkp@intel.com, oe-kbuild-all@lists.linux.dev,
	linux-usb@vger.kernel.org, raoxu@uniontech.com,
	Niklas Neronin <niklas.neronin@linux.intel.com>
Subject: Re: [PATCH 2/2] usb: xhci: add interrupter type
Date: Thu, 29 Jan 2026 09:59:26 +0300	[thread overview]
Message-ID: <202601290847.Cb6aLduh-lkp@intel.com> (raw)
In-Reply-To: <20260128131504.124322-3-niklas.neronin@linux.intel.com>

Hi Niklas,

kernel test robot noticed the following build warnings:

https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Niklas-Neronin/usb-xhci-move-Primary-Interrupter-IMODI-setup/20260128-211728
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
patch link:    https://lore.kernel.org/r/20260128131504.124322-3-niklas.neronin%40linux.intel.com
patch subject: [PATCH 2/2] usb: xhci: add interrupter type
config: x86_64-randconfig-161-20260129 (https://download.01.org/0day-ci/archive/20260129/202601290847.Cb6aLduh-lkp@intel.com/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
smatch version: v0.5.0-8994-gd50c5a4c

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
| Closes: https://lore.kernel.org/r/202601290847.Cb6aLduh-lkp@intel.com/

smatch warnings:
drivers/usb/host/xhci.c:320 xhci_enable_interrupter() warn: variable dereferenced before check 'ir' (see line 317)
drivers/usb/host/xhci.c:340 xhci_disable_interrupter() warn: variable dereferenced before check 'ir' (see line 337)

vim +/ir +320 drivers/usb/host/xhci.c

bea5892d0ed274 Mathias Nyman  2025-04-10  313  int xhci_enable_interrupter(struct xhci_interrupter *ir)
52dd0483e822d0 Mathias Nyman  2023-02-02  314  {
52dd0483e822d0 Mathias Nyman  2023-02-02  315  	u32 iman;
52dd0483e822d0 Mathias Nyman  2023-02-02  316  
486b278520fd70 Niklas Neronin 2026-01-28 @317  	if (ir->type == INTR_NOOP)
                                                    ^^^^^^^^
Dereferenced.

486b278520fd70 Niklas Neronin 2026-01-28  318  		return 0;
486b278520fd70 Niklas Neronin 2026-01-28  319  
52dd0483e822d0 Mathias Nyman  2023-02-02 @320  	if (!ir || !ir->ir_set)
                                                    ^^^
Checked too late.

52dd0483e822d0 Mathias Nyman  2023-02-02  321  		return -EINVAL;
52dd0483e822d0 Mathias Nyman  2023-02-02  322  
bf9cce90da311a Niklas Neronin 2025-05-15  323  	iman = readl(&ir->ir_set->iman);
ff9a09b3e09c7b Niklas Neronin 2025-08-19  324  	iman &= ~IMAN_IP;
9f7f74735ac295 Niklas Neronin 2025-05-15  325  	iman |= IMAN_IE;
bf9cce90da311a Niklas Neronin 2025-05-15  326  	writel(iman, &ir->ir_set->iman);
52dd0483e822d0 Mathias Nyman  2023-02-02  327  
f5bce30ad25e74 Niklas Neronin 2025-05-15  328  	/* Read operation to guarantee the write has been flushed from posted buffers */
bf9cce90da311a Niklas Neronin 2025-05-15  329  	readl(&ir->ir_set->iman);
52dd0483e822d0 Mathias Nyman  2023-02-02  330  	return 0;
52dd0483e822d0 Mathias Nyman  2023-02-02  331  }
52dd0483e822d0 Mathias Nyman  2023-02-02  332  
e1db856bd28891 Niklas Neronin 2025-05-15  333  int xhci_disable_interrupter(struct xhci_hcd *xhci, struct xhci_interrupter *ir)
52dd0483e822d0 Mathias Nyman  2023-02-02  334  {
52dd0483e822d0 Mathias Nyman  2023-02-02  335  	u32 iman;
52dd0483e822d0 Mathias Nyman  2023-02-02  336  
486b278520fd70 Niklas Neronin 2026-01-28 @337  	if (ir->type == INTR_NOOP)
                                                    ^^^^^^^^

486b278520fd70 Niklas Neronin 2026-01-28  338  		return 0;
486b278520fd70 Niklas Neronin 2026-01-28  339  
52dd0483e822d0 Mathias Nyman  2023-02-02 @340  	if (!ir || !ir->ir_set)
                                                    ^^^
Same.

52dd0483e822d0 Mathias Nyman  2023-02-02  341  		return -EINVAL;
52dd0483e822d0 Mathias Nyman  2023-02-02  342  
bf9cce90da311a Niklas Neronin 2025-05-15  343  	iman = readl(&ir->ir_set->iman);
ff9a09b3e09c7b Niklas Neronin 2025-08-19  344  	iman &= ~IMAN_IP;
9f7f74735ac295 Niklas Neronin 2025-05-15  345  	iman &= ~IMAN_IE;
bf9cce90da311a Niklas Neronin 2025-05-15  346  	writel(iman, &ir->ir_set->iman);
52dd0483e822d0 Mathias Nyman  2023-02-02  347  
bf9cce90da311a Niklas Neronin 2025-05-15  348  	iman = readl(&ir->ir_set->iman);
e1db856bd28891 Niklas Neronin 2025-05-15  349  	if (iman & IMAN_IP)
e1db856bd28891 Niklas Neronin 2025-05-15  350  		xhci_dbg(xhci, "%s: Interrupt pending\n", __func__);
e1db856bd28891 Niklas Neronin 2025-05-15  351  
52dd0483e822d0 Mathias Nyman  2023-02-02  352  	return 0;
52dd0483e822d0 Mathias Nyman  2023-02-02  353  }

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki


  reply	other threads:[~2026-01-29  6:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-28 13:15 [PATCH 0/2] usb: xhci: simplify interrupter handling Niklas Neronin
2026-01-28 13:15 ` [PATCH 1/2] usb: xhci: move Primary Interrupter IMODI setup Niklas Neronin
2026-01-28 13:15 ` [PATCH 2/2] usb: xhci: add interrupter type Niklas Neronin
2026-01-29  6:59   ` Dan Carpenter [this message]
2026-02-04  1:17   ` Wesley Cheng
2026-02-05 10:41     ` Neronin, Niklas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202601290847.Cb6aLduh-lkp@intel.com \
    --to=dan.carpenter@linaro.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=mathias.nyman@linux.intel.com \
    --cc=niklas.neronin@linux.intel.com \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=oe-kbuild@lists.linux.dev \
    --cc=raoxu@uniontech.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox