linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mtd: rawnand: brcmnand: Fix sparse warning in has_flash_dma()
@ 2019-10-18 23:38 Florian Fainelli
  2019-10-19  9:39 ` Miquel Raynal
  0 siblings, 1 reply; 3+ messages in thread
From: Florian Fainelli @ 2019-10-18 23:38 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Florian Fainelli, Brian Norris, Kamal Dasu, Miquel Raynal,
	Richard Weinberger, David Woodhouse, Marek Vasut,
	Vignesh Raghavendra, open list:BROADCOM STB NAND FLASH DRIVER,
	open list:BROADCOM STB NAND FLASH DRIVER, open list

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")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 drivers/mtd/nand/raw/brcmnand/brcmnand.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/raw/brcmnand/brcmnand.c b/drivers/mtd/nand/raw/brcmnand/brcmnand.c
index 15ef30b368a5..73f7a0945399 100644
--- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c
+++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c
@@ -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)
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] mtd: rawnand: brcmnand: Fix sparse warning in has_flash_dma()
  2019-10-18 23:38 [PATCH] mtd: rawnand: brcmnand: Fix sparse warning in has_flash_dma() Florian Fainelli
@ 2019-10-19  9:39 ` Miquel Raynal
  2019-10-21 16:41   ` Florian Fainelli
  0 siblings, 1 reply; 3+ messages in thread
From: Miquel Raynal @ 2019-10-19  9:39 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: linux-arm-kernel, Brian Norris, Kamal Dasu, Richard Weinberger,
	David Woodhouse, Marek Vasut, Vignesh Raghavendra,
	open list:BROADCOM STB NAND FLASH DRIVER,
	open list:BROADCOM STB NAND FLASH DRIVER, open list

Hi Florian,

Florian Fainelli <f.fainelli@gmail.com> wrote on Fri, 18 Oct 2019
16:38:44 -0700:

> 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.

> 
> Fixes: 27c5b17cd1b1 ("mtd: nand: add NAND driver "library" for Broadcom STB NAND controller")
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
> ---
>  drivers/mtd/nand/raw/brcmnand/brcmnand.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/mtd/nand/raw/brcmnand/brcmnand.c b/drivers/mtd/nand/raw/brcmnand/brcmnand.c
> index 15ef30b368a5..73f7a0945399 100644
> --- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c
> +++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c
> @@ -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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] mtd: rawnand: brcmnand: Fix sparse warning in has_flash_dma()
  2019-10-19  9:39 ` Miquel Raynal
@ 2019-10-21 16:41   ` Florian Fainelli
  0 siblings, 0 replies; 3+ messages in thread
From: Florian Fainelli @ 2019-10-21 16:41 UTC (permalink / raw)
  To: Miquel Raynal, Florian Fainelli
  Cc: linux-arm-kernel, Brian Norris, Kamal Dasu, Richard Weinberger,
	David Woodhouse, Marek Vasut, Vignesh Raghavendra,
	open list:BROADCOM STB NAND FLASH DRIVER,
	open list:BROADCOM STB NAND FLASH DRIVER, open list

On 10/19/19 2:39 AM, Miquel Raynal wrote:
> Hi Florian,
> 
> Florian Fainelli <f.fainelli@gmail.com> wrote on Fri, 18 Oct 2019
> 16:38:44 -0700:
> 
>> 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.
-- 
Florian

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-10-21 16:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-18 23:38 [PATCH] mtd: rawnand: brcmnand: Fix sparse warning in has_flash_dma() Florian Fainelli
2019-10-19  9:39 ` Miquel Raynal
2019-10-21 16:41   ` Florian Fainelli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).