* [PATCH v3] char: nvram: Remove unused nvram_mutex to fix -Wunused-variable warning
@ 2026-03-30 6:22 Venkat Rao Bagalkote
2026-03-30 6:42 ` Ritesh Harjani
2026-04-02 20:04 ` kernel test robot
0 siblings, 2 replies; 3+ messages in thread
From: Venkat Rao Bagalkote @ 2026-03-30 6:22 UTC (permalink / raw)
To: linux-kernel
Cc: linux-kbuild, linuxppc-dev, maddy, ritesh.list, arnd, chleroy,
Venkat Rao Bagalkote
drivers/char/nvram.c defines a static mutex 'nvram_mutex' which is never
used. This results in a compiler warning on linux-next builds:
warning: 'nvram_mutex' defined but not used [-Wunused-variable]
Remove the unused definition to avoid the warning.
Suggested-by: Arnd Bergmann <arnd@arndb.de>
Suggested-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
Signed-off-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com>
---
v3:
- Removed global nvram_mutex entirely
drivers/char/nvram.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/char/nvram.c b/drivers/char/nvram.c
index 9eff426a9286..9ab2744cd375 100644
--- a/drivers/char/nvram.c
+++ b/drivers/char/nvram.c
@@ -53,7 +53,6 @@
#include <asm/nvram.h>
#endif
-static DEFINE_MUTEX(nvram_mutex);
static DEFINE_SPINLOCK(nvram_state_lock);
static int nvram_open_cnt; /* #times opened */
static int nvram_open_mode; /* special open modes */
--
2.45.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v3] char: nvram: Remove unused nvram_mutex to fix -Wunused-variable warning
2026-03-30 6:22 [PATCH v3] char: nvram: Remove unused nvram_mutex to fix -Wunused-variable warning Venkat Rao Bagalkote
@ 2026-03-30 6:42 ` Ritesh Harjani
2026-04-02 20:04 ` kernel test robot
1 sibling, 0 replies; 3+ messages in thread
From: Ritesh Harjani @ 2026-03-30 6:42 UTC (permalink / raw)
To: Venkat Rao Bagalkote, linux-kernel
Cc: linux-kbuild, linuxppc-dev, maddy, arnd, chleroy,
Venkat Rao Bagalkote
Venkat Rao Bagalkote <venkat88@linux.ibm.com> writes:
> drivers/char/nvram.c defines a static mutex 'nvram_mutex' which is never
> used. This results in a compiler warning on linux-next builds:
>
> warning: 'nvram_mutex' defined but not used [-Wunused-variable]
>
> Remove the unused definition to avoid the warning.
>
That is not the only reason for removing the nvram_mutex. I think we
discussed in detail, why we think this can be removed here [1].
We should add those details in commit msg too.
> Suggested-by: Arnd Bergmann <arnd@arndb.de>
> Suggested-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
> Signed-off-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com>
> ---
> v3:
> - Removed global nvram_mutex entirely
We only removed the mutex definition and not the usage right. This does
not look correct. Maybe you can check sashiko review comments for
details -
https://sashiko.dev/#/patchset/20260330062201.2581-1-venkat88%40linux.ibm.com
-ritesh
>
> drivers/char/nvram.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/drivers/char/nvram.c b/drivers/char/nvram.c
> index 9eff426a9286..9ab2744cd375 100644
> --- a/drivers/char/nvram.c
> +++ b/drivers/char/nvram.c
> @@ -53,7 +53,6 @@
> #include <asm/nvram.h>
> #endif
>
> -static DEFINE_MUTEX(nvram_mutex);
> static DEFINE_SPINLOCK(nvram_state_lock);
> static int nvram_open_cnt; /* #times opened */
> static int nvram_open_mode; /* special open modes */
> --
> 2.45.2
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v3] char: nvram: Remove unused nvram_mutex to fix -Wunused-variable warning
2026-03-30 6:22 [PATCH v3] char: nvram: Remove unused nvram_mutex to fix -Wunused-variable warning Venkat Rao Bagalkote
2026-03-30 6:42 ` Ritesh Harjani
@ 2026-04-02 20:04 ` kernel test robot
1 sibling, 0 replies; 3+ messages in thread
From: kernel test robot @ 2026-04-02 20:04 UTC (permalink / raw)
To: Venkat Rao Bagalkote, linux-kernel
Cc: oe-kbuild-all, linux-kbuild, linuxppc-dev, maddy, ritesh.list,
arnd, chleroy, Venkat Rao Bagalkote
Hi Venkat,
kernel test robot noticed the following build errors:
[auto build test ERROR on char-misc/char-misc-testing]
[also build test ERROR on char-misc/char-misc-next char-misc/char-misc-linus linus/master v7.0-rc6 next-20260402]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Venkat-Rao-Bagalkote/char-nvram-Remove-unused-nvram_mutex-to-fix-Wunused-variable-warning/20260330-234134
base: char-misc/char-misc-testing
patch link: https://lore.kernel.org/r/20260330062201.2581-1-venkat88%40linux.ibm.com
patch subject: [PATCH v3] char: nvram: Remove unused nvram_mutex to fix -Wunused-variable warning
config: x86_64-rhel-9.4 (https://download.01.org/0day-ci/archive/20260402/202604022248.LErLuuXd-lkp@intel.com/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260402/202604022248.LErLuuXd-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/202604022248.LErLuuXd-lkp@intel.com/
All errors (new ones prefixed by >>):
drivers/char/nvram.c: In function 'nvram_misc_ioctl':
>> drivers/char/nvram.c:327:37: error: 'nvram_mutex' undeclared (first use in this function)
327 | mutex_lock(&nvram_mutex);
| ^~~~~~~~~~~
drivers/char/nvram.c:327:37: note: each undeclared identifier is reported only once for each function it appears in
vim +/nvram_mutex +327 drivers/char/nvram.c
^1da177e4c3f41 Linus Torvalds 2005-04-16 278
cb8d8006d43f22 Finn Thain 2019-01-15 279 static long nvram_misc_ioctl(struct file *file, unsigned int cmd,
55929332c92e5d Arnd Bergmann 2010-04-27 280 unsigned long arg)
^1da177e4c3f41 Linus Torvalds 2005-04-16 281 {
2d58636e0af724 Finn Thain 2019-01-15 282 long ret = -ENOTTY;
^1da177e4c3f41 Linus Torvalds 2005-04-16 283
^1da177e4c3f41 Linus Torvalds 2005-04-16 284 switch (cmd) {
95ac14b8a32817 Finn Thain 2019-01-15 285 #ifdef CONFIG_PPC
95ac14b8a32817 Finn Thain 2019-01-15 286 case OBSOLETE_PMAC_NVRAM_GET_OFFSET:
95ac14b8a32817 Finn Thain 2019-01-15 287 pr_warn("nvram: Using obsolete PMAC_NVRAM_GET_OFFSET ioctl\n");
df561f6688fef7 Gustavo A. R. Silva 2020-08-23 288 fallthrough;
95ac14b8a32817 Finn Thain 2019-01-15 289 case IOC_NVRAM_GET_OFFSET:
95ac14b8a32817 Finn Thain 2019-01-15 290 ret = -EINVAL;
95ac14b8a32817 Finn Thain 2019-01-15 291 #ifdef CONFIG_PPC_PMAC
95ac14b8a32817 Finn Thain 2019-01-15 292 if (machine_is(powermac)) {
95ac14b8a32817 Finn Thain 2019-01-15 293 int part, offset;
95ac14b8a32817 Finn Thain 2019-01-15 294
95ac14b8a32817 Finn Thain 2019-01-15 295 if (copy_from_user(&part, (void __user *)arg,
95ac14b8a32817 Finn Thain 2019-01-15 296 sizeof(part)) != 0)
95ac14b8a32817 Finn Thain 2019-01-15 297 return -EFAULT;
95ac14b8a32817 Finn Thain 2019-01-15 298 if (part < pmac_nvram_OF || part > pmac_nvram_NR)
95ac14b8a32817 Finn Thain 2019-01-15 299 return -EINVAL;
95ac14b8a32817 Finn Thain 2019-01-15 300 offset = pmac_get_partition(part);
20e07af71f34d9 Finn Thain 2019-01-15 301 if (offset < 0)
20e07af71f34d9 Finn Thain 2019-01-15 302 return -EINVAL;
95ac14b8a32817 Finn Thain 2019-01-15 303 if (copy_to_user((void __user *)arg,
95ac14b8a32817 Finn Thain 2019-01-15 304 &offset, sizeof(offset)) != 0)
95ac14b8a32817 Finn Thain 2019-01-15 305 return -EFAULT;
95ac14b8a32817 Finn Thain 2019-01-15 306 ret = 0;
95ac14b8a32817 Finn Thain 2019-01-15 307 }
95ac14b8a32817 Finn Thain 2019-01-15 308 #endif
95ac14b8a32817 Finn Thain 2019-01-15 309 break;
20e07af71f34d9 Finn Thain 2019-01-15 310 #ifdef CONFIG_PPC32
95ac14b8a32817 Finn Thain 2019-01-15 311 case IOC_NVRAM_SYNC:
95ac14b8a32817 Finn Thain 2019-01-15 312 if (ppc_md.nvram_sync != NULL) {
95ac14b8a32817 Finn Thain 2019-01-15 313 mutex_lock(&nvram_mutex);
95ac14b8a32817 Finn Thain 2019-01-15 314 ppc_md.nvram_sync();
95ac14b8a32817 Finn Thain 2019-01-15 315 mutex_unlock(&nvram_mutex);
95ac14b8a32817 Finn Thain 2019-01-15 316 }
95ac14b8a32817 Finn Thain 2019-01-15 317 ret = 0;
95ac14b8a32817 Finn Thain 2019-01-15 318 break;
20e07af71f34d9 Finn Thain 2019-01-15 319 #endif
95ac14b8a32817 Finn Thain 2019-01-15 320 #elif defined(CONFIG_X86) || defined(CONFIG_M68K)
^1da177e4c3f41 Linus Torvalds 2005-04-16 321 case NVRAM_INIT:
^1da177e4c3f41 Linus Torvalds 2005-04-16 322 /* initialize NVRAM contents and checksum */
^1da177e4c3f41 Linus Torvalds 2005-04-16 323 if (!capable(CAP_SYS_ADMIN))
^1da177e4c3f41 Linus Torvalds 2005-04-16 324 return -EACCES;
^1da177e4c3f41 Linus Torvalds 2005-04-16 325
2d58636e0af724 Finn Thain 2019-01-15 326 if (arch_nvram_ops.initialize != NULL) {
613655fa39ff69 Arnd Bergmann 2010-06-02 @327 mutex_lock(&nvram_mutex);
2d58636e0af724 Finn Thain 2019-01-15 328 ret = arch_nvram_ops.initialize();
613655fa39ff69 Arnd Bergmann 2010-06-02 329 mutex_unlock(&nvram_mutex);
2d58636e0af724 Finn Thain 2019-01-15 330 }
2d58636e0af724 Finn Thain 2019-01-15 331 break;
^1da177e4c3f41 Linus Torvalds 2005-04-16 332 case NVRAM_SETCKS:
^1da177e4c3f41 Linus Torvalds 2005-04-16 333 /* just set checksum, contents unchanged (maybe useful after
^1da177e4c3f41 Linus Torvalds 2005-04-16 334 * checksum garbaged somehow...) */
^1da177e4c3f41 Linus Torvalds 2005-04-16 335 if (!capable(CAP_SYS_ADMIN))
^1da177e4c3f41 Linus Torvalds 2005-04-16 336 return -EACCES;
^1da177e4c3f41 Linus Torvalds 2005-04-16 337
2d58636e0af724 Finn Thain 2019-01-15 338 if (arch_nvram_ops.set_checksum != NULL) {
613655fa39ff69 Arnd Bergmann 2010-06-02 339 mutex_lock(&nvram_mutex);
2d58636e0af724 Finn Thain 2019-01-15 340 ret = arch_nvram_ops.set_checksum();
613655fa39ff69 Arnd Bergmann 2010-06-02 341 mutex_unlock(&nvram_mutex);
^1da177e4c3f41 Linus Torvalds 2005-04-16 342 }
2d58636e0af724 Finn Thain 2019-01-15 343 break;
95ac14b8a32817 Finn Thain 2019-01-15 344 #endif /* CONFIG_X86 || CONFIG_M68K */
2d58636e0af724 Finn Thain 2019-01-15 345 }
2d58636e0af724 Finn Thain 2019-01-15 346 return ret;
^1da177e4c3f41 Linus Torvalds 2005-04-16 347 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 348
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-04-02 20:04 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-30 6:22 [PATCH v3] char: nvram: Remove unused nvram_mutex to fix -Wunused-variable warning Venkat Rao Bagalkote
2026-03-30 6:42 ` Ritesh Harjani
2026-04-02 20:04 ` kernel test robot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox