From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com, Julia Lawall <julia.lawall@inria.fr>
Subject: drivers/i2c/i2c-atr.c:265:6-9: ERROR: invalid reference to the index variable of the iterator on line 261
Date: Fri, 05 Jun 2026 03:08:14 +0800 [thread overview]
Message-ID: <202606050244.q6ApjQY8-lkp@intel.com> (raw)
BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
CC: linux-kernel@vger.kernel.org
TO: Romain Gantois <romain.gantois@bootlin.com>
CC: Wolfram Sang <wsa-dev@sang-engineering.com>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: ba3e43a9e601636f5edb54e259a74f96ca3b8fd8
commit: c3f55241882bd5b4bc84dbe77d2efd0d9574ed9c i2c: Support dynamic address translation
date: 1 year, 2 months ago
:::::: branch date: 2 days ago
:::::: commit date: 1 year, 2 months ago
config: mips-randconfig-r063-20260604 (https://download.01.org/0day-ci/archive/20260605/202606050244.q6ApjQY8-lkp@intel.com/config)
compiler: clang version 23.0.0git (https://github.com/llvm/llvm-project e5ab4f8a1f766febdc65ce89c00dec85393cfd68)
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
| Fixes: c3f55241882b ("i2c: Support dynamic address translation")
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Julia Lawall <julia.lawall@inria.fr>
| Closes: https://lore.kernel.org/r/202606050244.q6ApjQY8-lkp@intel.com/
cocci warnings: (new ones prefixed by >>)
>> drivers/i2c/i2c-atr.c:265:6-9: ERROR: invalid reference to the index variable of the iterator on line 261
vim +265 drivers/i2c/i2c-atr.c
c3f55241882bd5 Romain Gantois 2025-03-06 235
c3f55241882bd5 Romain Gantois 2025-03-06 236 /* Must be called with alias_pairs_lock held */
a076a860acae77 Luca Ceresoli 2023-06-19 237 static struct i2c_atr_alias_pair *
c3f55241882bd5 Romain Gantois 2025-03-06 238 i2c_atr_find_mapping_by_addr(struct i2c_atr_chan *chan, u16 addr)
a076a860acae77 Luca Ceresoli 2023-06-19 239 {
c3f55241882bd5 Romain Gantois 2025-03-06 240 struct i2c_atr *atr = chan->atr;
a076a860acae77 Luca Ceresoli 2023-06-19 241 struct i2c_atr_alias_pair *c2a;
c3f55241882bd5 Romain Gantois 2025-03-06 242 struct list_head *alias_pairs;
c3f55241882bd5 Romain Gantois 2025-03-06 243 u16 alias;
c3f55241882bd5 Romain Gantois 2025-03-06 244 int ret;
c3f55241882bd5 Romain Gantois 2025-03-06 245
c3f55241882bd5 Romain Gantois 2025-03-06 246 lockdep_assert_held(&chan->alias_pairs_lock);
a076a860acae77 Luca Ceresoli 2023-06-19 247
c3f55241882bd5 Romain Gantois 2025-03-06 248 alias_pairs = &chan->alias_pairs;
c3f55241882bd5 Romain Gantois 2025-03-06 249
c3f55241882bd5 Romain Gantois 2025-03-06 250 list_for_each_entry(c2a, alias_pairs, node) {
c3f55241882bd5 Romain Gantois 2025-03-06 251 if (c2a->addr == addr)
a076a860acae77 Luca Ceresoli 2023-06-19 252 return c2a;
a076a860acae77 Luca Ceresoli 2023-06-19 253 }
a076a860acae77 Luca Ceresoli 2023-06-19 254
c3f55241882bd5 Romain Gantois 2025-03-06 255 ret = i2c_atr_reserve_alias(chan->alias_pool);
c3f55241882bd5 Romain Gantois 2025-03-06 256 if (ret < 0) {
c3f55241882bd5 Romain Gantois 2025-03-06 257 // If no free aliases are left, replace an existing one
c3f55241882bd5 Romain Gantois 2025-03-06 258 if (unlikely(list_empty(alias_pairs)))
c3f55241882bd5 Romain Gantois 2025-03-06 259 return NULL;
c3f55241882bd5 Romain Gantois 2025-03-06 260
c3f55241882bd5 Romain Gantois 2025-03-06 @261 list_for_each_entry_reverse(c2a, alias_pairs, node)
c3f55241882bd5 Romain Gantois 2025-03-06 262 if (!c2a->fixed)
c3f55241882bd5 Romain Gantois 2025-03-06 263 break;
c3f55241882bd5 Romain Gantois 2025-03-06 264
c3f55241882bd5 Romain Gantois 2025-03-06 @265 if (c2a->fixed)
c3f55241882bd5 Romain Gantois 2025-03-06 266 return NULL;
c3f55241882bd5 Romain Gantois 2025-03-06 267
c3f55241882bd5 Romain Gantois 2025-03-06 268 atr->ops->detach_addr(atr, chan->chan_id, c2a->addr);
c3f55241882bd5 Romain Gantois 2025-03-06 269 c2a->addr = addr;
c3f55241882bd5 Romain Gantois 2025-03-06 270
c3f55241882bd5 Romain Gantois 2025-03-06 271 // Move updated entry to beginning of list
c3f55241882bd5 Romain Gantois 2025-03-06 272 list_move(&c2a->node, alias_pairs);
c3f55241882bd5 Romain Gantois 2025-03-06 273
c3f55241882bd5 Romain Gantois 2025-03-06 274 alias = c2a->alias;
c3f55241882bd5 Romain Gantois 2025-03-06 275 } else {
c3f55241882bd5 Romain Gantois 2025-03-06 276 alias = ret;
c3f55241882bd5 Romain Gantois 2025-03-06 277
c3f55241882bd5 Romain Gantois 2025-03-06 278 c2a = i2c_atr_create_c2a(chan, alias, addr);
c3f55241882bd5 Romain Gantois 2025-03-06 279 if (!c2a)
c3f55241882bd5 Romain Gantois 2025-03-06 280 goto err_release_alias;
c3f55241882bd5 Romain Gantois 2025-03-06 281 }
c3f55241882bd5 Romain Gantois 2025-03-06 282
c3f55241882bd5 Romain Gantois 2025-03-06 283 ret = atr->ops->attach_addr(atr, chan->chan_id, c2a->addr, c2a->alias);
c3f55241882bd5 Romain Gantois 2025-03-06 284 if (ret) {
c3f55241882bd5 Romain Gantois 2025-03-06 285 dev_err(atr->dev, "failed to attach 0x%02x on channel %d: err %d\n",
c3f55241882bd5 Romain Gantois 2025-03-06 286 addr, chan->chan_id, ret);
c3f55241882bd5 Romain Gantois 2025-03-06 287 goto err_del_c2a;
c3f55241882bd5 Romain Gantois 2025-03-06 288 }
c3f55241882bd5 Romain Gantois 2025-03-06 289
c3f55241882bd5 Romain Gantois 2025-03-06 290 return c2a;
c3f55241882bd5 Romain Gantois 2025-03-06 291
c3f55241882bd5 Romain Gantois 2025-03-06 292 err_del_c2a:
c3f55241882bd5 Romain Gantois 2025-03-06 293 i2c_atr_destroy_c2a(&c2a);
c3f55241882bd5 Romain Gantois 2025-03-06 294 err_release_alias:
c3f55241882bd5 Romain Gantois 2025-03-06 295 i2c_atr_release_alias(chan->alias_pool, alias);
a076a860acae77 Luca Ceresoli 2023-06-19 296 return NULL;
a076a860acae77 Luca Ceresoli 2023-06-19 297 }
a076a860acae77 Luca Ceresoli 2023-06-19 298
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
next reply other threads:[~2026-06-04 19:09 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-04 19:08 kernel test robot [this message]
-- strict thread matches above, loose matches on Subject: below --
2026-03-25 1:00 drivers/i2c/i2c-atr.c:265:6-9: ERROR: invalid reference to the index variable of the iterator on line 261 kernel test robot
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=202606050244.q6ApjQY8-lkp@intel.com \
--to=lkp@intel.com \
--cc=julia.lawall@inria.fr \
--cc=oe-kbuild@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.