lib/test_context-analysis.c:114 test_spinlock_trylock_extra() warn: mixing irq and irqsave

kernel test robot <[email protected]>
Newsgroups dev.linux.lists.oe-kbuild
Message-ID <[email protected]>
BCC: [email protected]
CC: [email protected]
CC: [email protected]
TO: Marco Elver <[email protected]>
CC: Peter Zijlstra <[email protected]>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   3f008280327ba5ad132965abab0c7846283cef0c
commit: f16a802d402d735a55731f8c94952b3bbb5ddfe8 locking/rwlock, spinlock: Support Clang's context analysis
date:   7 months ago
:::::: branch date: 2 hours ago
:::::: commit date: 7 months ago
config: openrisc-randconfig-r073-20260807 (https://download.01.org/0day-ci/archive/20260808/[email protected]/config)
compiler: or1k-linux-gcc (GCC) 10.5.0
smatch: v0.5.0-9187-g5189e3fb

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: f16a802d402d ("locking/rwlock, spinlock: Support Clang's context analysis")
| Reported-by: kernel test robot <[email protected]>
| Reported-by: Dan Carpenter <[email protected]>
| Closes: https://lore.kernel.org/r/[email protected]/

New smatch warnings:
lib/test_context-analysis.c:114 test_spinlock_trylock_extra() warn: mixing irq and irqsave

Old smatch warnings:
lib/test_context-analysis.c:90 test_raw_spinlock_trylock_extra() warn: mixing irq and irqsave
include/linux/spinlock.h:556 class_raw_spinlock_try_constructor() warn: passing zero to 'ERR_PTR'
include/linux/spinlock.h:604 class_spinlock_try_constructor() warn: passing zero to 'ERR_PTR'

vim +114 lib/test_context-analysis.c

f16a802d402d73 Marco Elver 2025-12-19   98  
f16a802d402d73 Marco Elver 2025-12-19   99  TEST_SPINLOCK_COMMON(spinlock,
f16a802d402d73 Marco Elver 2025-12-19  100  		     spinlock_t,
f16a802d402d73 Marco Elver 2025-12-19  101  		     spin_lock_init,
f16a802d402d73 Marco Elver 2025-12-19  102  		     spin_lock,
f16a802d402d73 Marco Elver 2025-12-19  103  		     spin_unlock,
f16a802d402d73 Marco Elver 2025-12-19  104  		     spin_trylock,
f16a802d402d73 Marco Elver 2025-12-19  105  		     TEST_OP_RW);
f16a802d402d73 Marco Elver 2025-12-19  106  static void __used test_spinlock_trylock_extra(struct test_spinlock_data *d)
f16a802d402d73 Marco Elver 2025-12-19  107  {
f16a802d402d73 Marco Elver 2025-12-19  108  	unsigned long flags;
f16a802d402d73 Marco Elver 2025-12-19  109  
f16a802d402d73 Marco Elver 2025-12-19  110  	if (spin_trylock_irq(&d->lock)) {
f16a802d402d73 Marco Elver 2025-12-19  111  		d->counter++;
f16a802d402d73 Marco Elver 2025-12-19  112  		spin_unlock_irq(&d->lock);
f16a802d402d73 Marco Elver 2025-12-19  113  	}
f16a802d402d73 Marco Elver 2025-12-19 @114  	if (spin_trylock_irqsave(&d->lock, flags)) {
f16a802d402d73 Marco Elver 2025-12-19  115  		d->counter++;
f16a802d402d73 Marco Elver 2025-12-19  116  		spin_unlock_irqrestore(&d->lock, flags);
f16a802d402d73 Marco Elver 2025-12-19  117  	}
f16a802d402d73 Marco Elver 2025-12-19  118  	scoped_cond_guard(spinlock_try, return, &d->lock) {
f16a802d402d73 Marco Elver 2025-12-19  119  		d->counter++;
f16a802d402d73 Marco Elver 2025-12-19  120  	}
f16a802d402d73 Marco Elver 2025-12-19  121  }
f16a802d402d73 Marco Elver 2025-12-19  122  

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.