Subject: Re: [PATCH v3] char: nvram: Remove unused nvram_mutex to fix -Wunused-variable warning

From: Ritesh Harjani (IBM) <[email-masked]>
Date: Mon, 30 Mar 2026 12:12:28 +0530

Venkat Rao Bagalkote <[email-masked]> 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 <[email-masked]>
> Suggested-by: Ritesh Harjani (IBM) <[email-masked]>
> Signed-off-by: Venkat Rao Bagalkote <[email-masked]>
> ---
> 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