char: nvram: Remove unused nvram_mutex to fix -Wunused-variable warning
Subsystems (2)
PATCH 1/1 char: nvram: Remove unused nvram_mutex to fix -Wunused-variable warning
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.
--- drivers/char/nvram.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/char/nvram.c +1 -1
@@ -53,7 +53,7 @@#include <asm/nvram.h> #endif -static DEFINE_MUTEX (nvram_mutex); +static __maybe_unused 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 */
Signature · 1 line
2.45.2
Please ignore this. Sent v2 [1]
[1]: https://lore.kernel.org/all/[email protected]/
Regards,
Venkat.
Quoted 25 lines · Venkat Rao Bagalkote
drivers/char/nvram.cdefines 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 <[email protected]>--- drivers/char/nvram.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/char/nvram.c +1
-1@@ -53,7 +53,7 @@#include <asm/nvram.h> #endif -static DEFINE_MUTEX (nvram_mutex); +static __maybe_unused 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 */
Greg KH
maintainerQuoted 17 lines · Venkat Rao Bagalkote
drivers/char/nvram.cdefines 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 <[email protected]>--- drivers/char/nvram.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/char/nvram.c +0
-0
drivers/char/nvram.c line 56
Quoted 5 lines
drivers/char/nvram.c +1
-1@@ -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 :(
thanks,
greg k-h
Arnd Bergmann
maintainerQuoted 21 lines · Greg KH
Quoted 20 lines · Venkat Rao Bagalkote
drivers/char/nvram.cdefines 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 <[email protected]>--- drivers/char/nvram.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/char/nvram.c +0
-0@@ -53,7 +53,7 @@#include <asm/nvram.h> #endif
Quoted 5 lines
drivers/char/nvram.c line 56
Quoted 2 lines
drivers/char/nvram.c +1
-1-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