Building the Linux kernel with Clang and LLVM
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Jonas Gorski <jonas.gorski@gmail.com>
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev
Subject: [kanjimonster:b53/wip 10/12] drivers/net/dsa/b53/b53_common.c:2590:28: warning: variable 'i' is uninitialized when used here
Date: Tue, 4 Nov 2025 09:22:32 +0800	[thread overview]
Message-ID: <202511040948.TxkC68cF-lkp@intel.com> (raw)

tree:   https://github.com/KanjiMonster/linux b53/wip
head:   4bd0d15e25ab64f157bf00b4c39bd1ef94da1ff5
commit: 70fb214830ff40f92fbfbacf66223b3cd3e803b9 [10/12] net: dsa: b53: add MSTI support
config: i386-buildonly-randconfig-002-20251104 (https://download.01.org/0day-ci/archive/20251104/202511040948.TxkC68cF-lkp@intel.com/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251104/202511040948.TxkC68cF-lkp@intel.com/reproduce)

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>
| Closes: https://lore.kernel.org/oe-kbuild-all/202511040948.TxkC68cF-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/net/dsa/b53/b53_common.c:2590:28: warning: variable 'i' is uninitialized when used here [-Wuninitialized]
    2590 |                 if (dsa_to_port(dev->ds, i)->bridge)
         |                                          ^
   drivers/net/dsa/b53/b53_common.c:2582:8: note: initialize the variable 'i' to silence this warning
    2582 |                 int i;
         |                      ^
         |                       = 0
   1 warning generated.


vim +/i +2590 drivers/net/dsa/b53/b53_common.c

  2574	
  2575	void b53_br_set_stp_state(struct dsa_switch *ds, int port, u8 state)
  2576	{
  2577		struct b53_device *dev = ds->priv;
  2578		u8 hw_state;
  2579		u8 reg;
  2580	
  2581		if (dev->num_msts) {
  2582			int i;
  2583	
  2584			if (port == B53_CPU_PORT)
  2585				return;
  2586	
  2587			/* Update CIST entry */
  2588			b53_set_mst_state(dev, port, 0, state);
  2589	
> 2590			if (dsa_to_port(dev->ds, i)->bridge)
  2591				return;
  2592	
  2593			for (i = 1; i < dev->num_msts; i++)
  2594				b53_set_mst_state(dev, port, i, state);
  2595		} else {
  2596			switch (state) {
  2597				case BR_STATE_DISABLED:
  2598					hw_state = PORT_CTRL_DIS_STATE;
  2599					break;
  2600				case BR_STATE_LISTENING:
  2601					hw_state = PORT_CTRL_LISTEN_STATE;
  2602					break;
  2603				case BR_STATE_LEARNING:
  2604					hw_state = PORT_CTRL_LEARN_STATE;
  2605					break;
  2606				case BR_STATE_FORWARDING:
  2607					hw_state = PORT_CTRL_FWD_STATE;
  2608					break;
  2609				case BR_STATE_BLOCKING:
  2610					hw_state = PORT_CTRL_BLOCK_STATE;
  2611					break;
  2612				default:
  2613					dev_err(ds->dev, "invalid STP state: %d\n", state);
  2614					return;
  2615	
  2616				b53_read8(dev, B53_CTRL_PAGE, B53_PORT_CTRL(port), &reg);
  2617				reg &= ~PORT_CTRL_STP_STATE_MASK;
  2618				reg |= hw_state;
  2619				b53_write8(dev, B53_CTRL_PAGE, B53_PORT_CTRL(port), reg);
  2620			}
  2621		}
  2622	}
  2623	EXPORT_SYMBOL(b53_br_set_stp_state);
  2624	

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

                 reply	other threads:[~2025-11-04  1:23 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=202511040948.TxkC68cF-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=jonas.gorski@gmail.com \
    --cc=llvm@lists.linux.dev \
    --cc=oe-kbuild-all@lists.linux.dev \
    /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