mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH master] watchdog: dw_wdt: fix resource reservation error check
@ 2021-06-21  6:47 Ahmad Fatoum
  2021-06-21  7:57 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2021-06-21  6:47 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

dev_request_mem_resource returns a possible error pointer. If it
succeeds mem->start will always be valid. Rectify the confusion.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 drivers/watchdog/dw_wdt.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/watchdog/dw_wdt.c b/drivers/watchdog/dw_wdt.c
index 70d6f0cced72..774d211a5f90 100644
--- a/drivers/watchdog/dw_wdt.c
+++ b/drivers/watchdog/dw_wdt.c
@@ -143,9 +143,10 @@ static int dw_wdt_drv_probe(struct device_d *dev)
 	dw_wdt = xzalloc(sizeof(*dw_wdt));
 
 	mem = dev_request_mem_resource(dev, 0);
+	if (IS_ERR(mem))
+		return PTR_ERR(mem);
+
 	dw_wdt->regs = IOMEM(mem->start);
-	if (IS_ERR(dw_wdt->regs))
-		return PTR_ERR(dw_wdt->regs);
 
 	clk = clk_get(dev, NULL);
 	if (IS_ERR(clk))
-- 
2.29.2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


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

* Re: [PATCH master] watchdog: dw_wdt: fix resource reservation error check
  2021-06-21  6:47 [PATCH master] watchdog: dw_wdt: fix resource reservation error check Ahmad Fatoum
@ 2021-06-21  7:57 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2021-06-21  7:57 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: barebox

On Mon, Jun 21, 2021 at 08:47:19AM +0200, Ahmad Fatoum wrote:
> dev_request_mem_resource returns a possible error pointer. If it
> succeeds mem->start will always be valid. Rectify the confusion.
> 
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
>  drivers/watchdog/dw_wdt.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)

Applied, thanks

Sascha

> 
> diff --git a/drivers/watchdog/dw_wdt.c b/drivers/watchdog/dw_wdt.c
> index 70d6f0cced72..774d211a5f90 100644
> --- a/drivers/watchdog/dw_wdt.c
> +++ b/drivers/watchdog/dw_wdt.c
> @@ -143,9 +143,10 @@ static int dw_wdt_drv_probe(struct device_d *dev)
>  	dw_wdt = xzalloc(sizeof(*dw_wdt));
>  
>  	mem = dev_request_mem_resource(dev, 0);
> +	if (IS_ERR(mem))
> +		return PTR_ERR(mem);
> +
>  	dw_wdt->regs = IOMEM(mem->start);
> -	if (IS_ERR(dw_wdt->regs))
> -		return PTR_ERR(dw_wdt->regs);
>  
>  	clk = clk_get(dev, NULL);
>  	if (IS_ERR(clk))
> -- 
> 2.29.2
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


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

end of thread, other threads:[~2021-06-21  7:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-21  6:47 [PATCH master] watchdog: dw_wdt: fix resource reservation error check Ahmad Fatoum
2021-06-21  7:57 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox