Skip to contentSkip to conversation

mtd: rawnand: brcmnand: Fix sparse warning in has_flash_dma()

PATCH In review Florian Fainelli 2 participants 3 messages Oct 19, 2019 – Oct 21, 2019

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

PATCH 1/1 mtd: rawnand: brcmnand: Fix sparse warning in has_flash_dma()

Sparse rightfully complained about has_flash_dma():
+drivers/mtd/nand/brcmnand/brcmnand.c:951:40: warning: Using plain integer as NULL pointer [sparse]

Fixes 27c5b17cd1b1 ("mtd: nand: add NAND driver "library" for Broadcom STB NAND controller")
---
 drivers/mtd/nand/raw/brcmnand/brcmnand.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/nand/raw/brcmnand/brcmnand.c +1 -1
index 15ef30b368a5..73f7a0945399 100644
@@ -909,7 +909,7 @@ static inline void brcmnand_set_wp(struct brcmnand_controller *ctrl, bool en)
 
 static inline bool has_flash_dma(struct brcmnand_controller *ctrl)
 {
-	return ctrl->flash_dma_base;
+	return ctrl->flash_dma_base != NULL;
 }
 
 static inline void disable_ctrl_irqs(struct brcmnand_controller *ctrl)
Signature · 7 lines
2.17.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
maintainer
#1 lore raw

Hi Florian,

Florian Fainelli <[email protected]> wrote on Fri, 18 Oct 2019 16:38:44 -0700:

Quoted 2 lines

Sparse rightfully complained about has_flash_dma():
+drivers/mtd/nand/brcmnand/brcmnand.c:951:40: warning: Using plain integer as NULL pointer [sparse]

I don't get why would sparse complain about this... Anyway I prefer the !!(<pointer>) alternative if you don't mind. Otherwise the "!= NULL" comparison feels wrong.

Quoted 12 lines
Fixes 27c5b17cd1b1 ("mtd: nand: add NAND driver "library" for Broadcom STB NAND controller")
---
 drivers/mtd/nand/raw/brcmnand/brcmnand.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/nand/raw/brcmnand/brcmnand.c +0 -0
index 15ef30b368a5..73f7a0945399 100644

drivers/mtd/nand/raw/brcmnand/brcmnand.c static inline void brcmnand_set_wp(struct brcmnand_controller *ctrl, bool en) · line 915

Quoted 8 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c +1 -1
@@ -909,7 +909,7 @@ static inline void brcmnand_set_wp(struct brcmnand_controller *ctrl, bool en)
 
 static inline bool has_flash_dma(struct brcmnand_controller *ctrl)
 {
-	return ctrl->flash_dma_base;
+	return ctrl->flash_dma_base != NULL;
 }
 
 static inline void disable_ctrl_irqs(struct brcmnand_controller *ctrl)

Thanks,
Miquèl

#2 lore raw
Quoted 11 lines · Miquel Raynal

Hi Florian,

Florian Fainelli <[email protected]> wrote on Fri, 18 Oct 2019 16:38:44 -0700:

Quoted 2 lines

Sparse rightfully complained about has_flash_dma():
+drivers/mtd/nand/brcmnand/brcmnand.c:951:40: warning: Using plain integer as NULL pointer [sparse]

I don't get why would sparse complain about this... Anyway I prefer the !!(<pointer>) alternative if you don't mind. Otherwise the "!= NULL" comparison feels wrong.

I did not read the sparse complaint correctly and mixed up two issues (one downstream, one upstream) there is still one that is legitimately reported by sparse and that will be fixed in a v2, thanks.

Signature · 1 line
Florian