[PATCH] char: nvram: Remove unused nvram_mutex to fix -Wunused-variable warning
Arnd Bergmann
arnd at arndb.de
Mon Mar 23 18:59:35 AEDT 2026
On Mon, Mar 23, 2026, at 08:36, Greg KH wrote:
> On Mon, Mar 23, 2026 at 12:54:22PM +0530, Venkat Rao Bagalkote wrote:
>> 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.
>>
>> Signed-off-by: Venkat Rao Bagalkote <venkat88 at linux.ibm.com>
>> ---
>> drivers/char/nvram.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/char/nvram.c b/drivers/char/nvram.c
>> index 9eff426a9286..2ce3307663ed 100644
>> --- a/drivers/char/nvram.c
>> +++ b/drivers/char/nvram.c
>> @@ -53,7 +53,7 @@
>> #include <asm/nvram.h>
>> #endif
>>
>> -static DEFINE_MUTEX(nvram_mutex);
>> +static __maybe_unused DEFINE_MUTEX(nvram_mutex);
>
> If it is never used, why not actually delete it? This just papers over
> the real issue :(
It's used on ppc32, atari and x86, but not ppc64.
However, I see that all the implementations that have the
mutex in their code path also have an inner spinlock that
does the same thing, while the mutex is a renmant from my
613655fa39ff ("drivers: autoconvert trivial BKL users to
private mutex").
I'm fairly sure we can actually remove it.
Arnd
More information about the Linuxppc-dev
mailing list