Skip to contentSkip to conversation

arch/parisc/kernel/firmware.c:1271 pdc_soft_power_button_panic() error: uninitialized symbol 'flags'.

PATCH In review Dan Carpenter 2 participants 2 messages Mar 28, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 646/7309 arch/parisc/kernel/firmware.c:1271 pdc_soft_power_button_panic() error: uninitialized symbol 'flags'.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   a6faf7ea9fcb7267d06116d4188947f26e00e57e
commit: cf559f6a9e3a7228f402dc43cff08d0a47ee8b7c [646/7309] parisc: Replace regular spinlock with spin_trylock on panic path
config: parisc-randconfig-m031-20230326 (https://download.01.org/0day-ci/archive/20230328/[email protected]/config)
compiler: hppa-linux-gcc (GCC) 12.1.0

If you fix the issue, kindly add following tag where applicable

| Reported-by: kernel test robot <[email protected]>
| Reported-by: Dan Carpenter <[email protected]>
| Link: https://lore.kernel.org/r/[email protected]/

New smatch warnings:
arch/parisc/kernel/firmware.c:1271 pdc_soft_power_button_panic() error: uninitialized symbol 'flags'.

Old smatch warnings:
arch/parisc/kernel/firmware.c:779 pdc_stable_read() warn: inconsistent indenting arch/parisc/kernel/firmware.c:805 pdc_stable_write() warn: inconsistent indenting arch/parisc/kernel/firmware.c:830 pdc_stable_get_size() warn: inconsistent indenting arch/parisc/kernel/firmware.c:850 pdc_stable_verify_contents() warn: inconsistent indenting arch/parisc/kernel/firmware.c:869 pdc_stable_initialize() warn: inconsistent indenting

vim +/flags +1271 arch/parisc/kernel/firmware.c

cf559f6a9e3a72 Guilherme G. Piccoli 2023-02-20  1260  int pdc_soft_power_button_panic(int sw_control)
cf559f6a9e3a72 Guilherme G. Piccoli 2023-02-20  1261  {
cf559f6a9e3a72 Guilherme G. Piccoli 2023-02-20  1262  	int retval;
cf559f6a9e3a72 Guilherme G. Piccoli 2023-02-20  1263  	unsigned long flags;
cf559f6a9e3a72 Guilherme G. Piccoli 2023-02-20  1264  
cf559f6a9e3a72 Guilherme G. Piccoli 2023-02-20  1265  	if (!spin_trylock_irqsave(&pdc_lock, flags)) {
cf559f6a9e3a72 Guilherme G. Piccoli 2023-02-20  1266  		pr_emerg("Couldn't enable soft power button\n");
cf559f6a9e3a72 Guilherme G. Piccoli 2023-02-20  1267  		return -EBUSY; /* ignored by the panic notifier */
cf559f6a9e3a72 Guilherme G. Piccoli 2023-02-20  1268  	}
cf559f6a9e3a72 Guilherme G. Piccoli 2023-02-20  1269  
cf559f6a9e3a72 Guilherme G. Piccoli 2023-02-20  1270  	retval = mem_pdc_call(PDC_SOFT_POWER, PDC_SOFT_POWER_ENABLE, __pa(pdc_result), sw_control);

cf559f6a9e3a72 Guilherme G. Piccoli 2023-02-20 @1271 spin_unlock_irqrestore(&pdc_lock, flags);

This is a weird warning. I wonder if it has to do with the BOOTLOADER stuff at the start of the file:

arch/parisc/kernel/firmware.c

    67  
    68  #if defined(BOOTLOADER)
    69  # undef  spin_lock_irqsave
    70  # define spin_lock_irqsave(a, b) { b = 1; }
    71  # undef  spin_unlock_irqrestore
    72  # define spin_unlock_irqrestore(a, b)
    73  #else
    74  static DEFINE_SPINLOCK(pdc_lock);
    75  #endif

No idea about parisc stuff though so I might be very wrong.

cf559f6a9e3a72 Guilherme G. Piccoli 2023-02-20  1272  
cf559f6a9e3a72 Guilherme G. Piccoli 2023-02-20  1273  	return retval;
cf559f6a9e3a72 Guilherme G. Piccoli 2023-02-20  1274  }
Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests
#1 lore raw
Quoted 40 lines · Dan Carpenter
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   a6faf7ea9fcb7267d06116d4188947f26e00e57e
commit: cf559f6a9e3a7228f402dc43cff08d0a47ee8b7c [646/7309] parisc: Replace regular spinlock with spin_trylock on panic path
config: parisc-randconfig-m031-20230326 (https://download.01.org/0day-ci/archive/20230328/[email protected]/config)
compiler: hppa-linux-gcc (GCC) 12.1.0

If you fix the issue, kindly add following tag where applicable

| Reported-by: kernel test robot <[email protected]>
| Reported-by: Dan Carpenter <[email protected]>
| Link: https://lore.kernel.org/r/[email protected]/

New smatch warnings:
arch/parisc/kernel/firmware.c:1271 pdc_soft_power_button_panic() error: uninitialized symbol 'flags'.

Old smatch warnings:
arch/parisc/kernel/firmware.c:779 pdc_stable_read() warn: inconsistent indenting arch/parisc/kernel/firmware.c:805 pdc_stable_write() warn: inconsistent indenting arch/parisc/kernel/firmware.c:830 pdc_stable_get_size() warn: inconsistent indenting arch/parisc/kernel/firmware.c:850 pdc_stable_verify_contents() warn: inconsistent indenting arch/parisc/kernel/firmware.c:869 pdc_stable_initialize() warn: inconsistent indenting

vim +/flags +1271 arch/parisc/kernel/firmware.c

cf559f6a9e3a72 Guilherme G. Piccoli 2023-02-20  1260  int pdc_soft_power_button_panic(int sw_control)
cf559f6a9e3a72 Guilherme G. Piccoli 2023-02-20  1261  {
cf559f6a9e3a72 Guilherme G. Piccoli 2023-02-20  1262  	int retval;
cf559f6a9e3a72 Guilherme G. Piccoli 2023-02-20  1263  	unsigned long flags;
cf559f6a9e3a72 Guilherme G. Piccoli 2023-02-20  1264  
cf559f6a9e3a72 Guilherme G. Piccoli 2023-02-20  1265  	if (!spin_trylock_irqsave(&pdc_lock, flags)) {
cf559f6a9e3a72 Guilherme G. Piccoli 2023-02-20  1266  		pr_emerg("Couldn't enable soft power button\n");
cf559f6a9e3a72 Guilherme G. Piccoli 2023-02-20  1267  		return -EBUSY; /* ignored by the panic notifier */
cf559f6a9e3a72 Guilherme G. Piccoli 2023-02-20  1268  	}
cf559f6a9e3a72 Guilherme G. Piccoli 2023-02-20  1269  
cf559f6a9e3a72 Guilherme G. Piccoli 2023-02-20  1270  	retval = mem_pdc_call(PDC_SOFT_POWER, PDC_SOFT_POWER_ENABLE, __pa(pdc_result), sw_control);

cf559f6a9e3a72 Guilherme G. Piccoli 2023-02-20 @1271 spin_unlock_irqrestore(&pdc_lock, flags);

This is a weird warning. I wonder if it has to do with the BOOTLOADER stuff at the start of the file:

arch/parisc/kernel/firmware.c

Quoted 10 lines
    67  
    68  #if defined(BOOTLOADER)
    69  # undef  spin_lock_irqsave
    70  # define spin_lock_irqsave(a, b) { b = 1; }
    71  # undef  spin_unlock_irqrestore
    72  # define spin_unlock_irqrestore(a, b)
    73  #else
    74  static DEFINE_SPINLOCK(pdc_lock);
    75  #endif

Interesting finding, but spin_trylock_irqsave() is not redefined in this block, so it's a bit confusing...