Re: [PATCH] dma: ste_dma40: fix unneeded variable warning
From: Arnd Bergmann <arnd@arndb.de>
Date: 2019-07-12 20:32:24
Also in:
dmaengine, lkml
On Fri, Jul 12, 2019 at 9:17 PM 'Nick Desaulniers' via Clang Built Linux [off-list ref] wrote:
On Fri, Jul 12, 2019 at 10:39 AM Nathan Chancellor [off-list ref] wrote:quoted
On Fri, Jul 12, 2019 at 11:13:30AM +0200, Arnd Bergmann wrote:quoted
clang-9 points out that there are two variables that depending on the configuration may only be used in an ARRAY_SIZE() expression but not referenced: drivers/dma/ste_dma40.c:145:12: error: variable 'd40_backup_regs' is not needed and will not be emitted [-Werror,-Wunneeded-internal-declaration] static u32 d40_backup_regs[] = { ^ drivers/dma/ste_dma40.c:214:12: error: variable 'd40_backup_regs_chan' is not needed and will not be emitted [-Werror,-Wunneeded-internal-declaration] static u32 d40_backup_regs_chan[] = { Mark these __maybe_unused to shut up the warning. Signed-off-by: Arnd Bergmann <arnd@arndb.de>Thanks for the patch!quoted
Might be worth mentioning that this warning will only appear when CONFIG_PM is unset (they are both used in d40_save_restore_registers).So would moving the definition into a #ifdef CONFIG_PM #endif block be better than __maybe_unused?
That would not work here, since the driver still uses ARRAY_SIZE() on
the variable.
Even more #ifdefs could solve that as well, but I don't want to spend too much
effort on this driver since it has almost no users.
Arnd
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel