mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH master] watchdog: dw_wdt: fix resource reservation error check
Date: Mon, 21 Jun 2021 08:47:19 +0200	[thread overview]
Message-ID: <20210621064719.19246-1-a.fatoum@pengutronix.de> (raw)

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


             reply	other threads:[~2021-06-21  6:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-21  6:47 Ahmad Fatoum [this message]
2021-06-21  7:57 ` Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210621064719.19246-1-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox