[PATCH v2] char: nvram: Remove unused nvram_mutex to fix -Wunused-variable warning
Ritesh Harjani (IBM)
ritesh.list at gmail.com
Wed Mar 25 20:04:04 AEDT 2026
"Christophe Leroy (CS GROUP)" <chleroy at kernel.org> writes:
> Le 23/03/2026 à 08:32, Venkat Rao Bagalkote a écrit :
>> v2:
>> - Added missing Suggested-by tag from Ritesh Harjani (IBM)
>>
>
> Patch history must go _after_ the --- below, otherwise it will appear in
> the commit message when applied, which is pointless.
>
>> drivers/char/nvram.c defines a static mutex 'nvram_mutex' which is never
>> used. This results in a compiler warning on linux-next builds:
>
> It is probably not only linux-next builds, I think the problem exists
> since 20e07af71f34 ("powerpc: Adopt nvram module for PPC64")
>
>>
>> warning: 'nvram_mutex' defined but not used [-Wunused-variable]
>>
>> Remove the unused definition to avoid the warning.
>
> It is not what you are doing.
>
> You are just hiding the probleme by saying 'maybe it is used, maybe it
> is not used, I don't know I don't care".
Venkat, do cares about this warning, and hence he sent the patch in trying to fix it ;)
I think, I missed seeing the upper #ifdef block of PPC, and hence
suggested him to use __maybe_unused, instead of complicating it
further with... #if defined(CONFIG_PPC32) || defined(CONFIG_X86) || defined(CONFIG_M68K),
> Please properly fix the problem instead.
>
I agree, make sense.
> I think the fix is probably to remove the #ifdef CONFIG_PPC32 around
> IOC_NVRAM_SYNC.
> If you think it is important to return -ENOTTY on CONFIG_PPC64, just add:
>
That make sense and I should have thought of that.
However, I looked at the suggestions from Arnd, and I too agree that all
underneath function operations already do their own locking, so I agree
that we could just kill this nvram_mutex lock itself.
-ritesh
More information about the Linuxppc-dev
mailing list