Skip to contentSkip to conversation

mtd: rawnand: ams-delta: Fix non-OF build warning

PATCH Applied Janusz Krzysztofik 2 participants 2 messages Sep 19, 2020 – Sep 28, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mtd: rawnand: ams-delta: Fix non-OF build warning

Commit 7c2f66a960fc ("mtd: rawnand: ams-delta: Add module device tables") introduced an OF module device table but wrapped a reference to it with of_match_ptr() which resolves to NULL in non-OF configs. That resulted in a clang compiler warning on unused variable in non-OF builds. Fix it.

drivers/mtd/nand/raw/ams-delta.c:373:34: warning: unused variable 'gpio_nand_of_id_table' [-Wunused-const-variable]

   static const struct of_device_id gpio_nand_of_id_table[] = {
                                    ^

1 warning generated.

Fixes 7c2f66a960fc ("mtd: rawnand: ams-delta: Add module device tables")
---
 drivers/mtd/nand/raw/ams-delta.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/mtd/nand/raw/ams-delta.c +2 -0
index fdba155416d2..0bf4cfc25147 100644
@@ -400,12 +400,14 @@ static int gpio_nand_remove(struct platform_device *pdev)
 	return 0;
 }
 
+#ifdef CONFIG_OF
 static const struct of_device_id gpio_nand_of_id_table[] = {
 	{
 		/* sentinel */
 	},
 };
 MODULE_DEVICE_TABLE(of, gpio_nand_of_id_table);
+#endif
 
 static const struct platform_device_id gpio_nand_plat_id_table[] = {
 	{
Signature · 1 line
2.26.2
maintainer Applied
#1 lore raw
Quoted 6 lines · Janusz Krzysztofik

Commit 7c2f66a960fc ("mtd: rawnand: ams-delta: Add module device tables") introduced an OF module device table but wrapped a reference to it with of_match_ptr() which resolves to NULL in non-OF configs. That resulted in a clang compiler warning on unused variable in non-OF builds. Fix it.

Quoted 8 lines

drivers/mtd/nand/raw/ams-delta.c:373:34: warning: unused variable 'gpio_nand_of_id_table' [-Wunused-const-variable]

   static const struct of_device_id gpio_nand_of_id_table[] = {
                                    ^

1 warning generated.

Fixes 7c2f66a960fc ("mtd: rawnand: ams-delta: Add module device tables")

Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next, thanks.

Miquel