linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
To: wim@linux-watchdog.org, linux@roeck-us.net, martyn.welch@gefanuc.com
Cc: linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org,
	kernel-janitors@vger.kernel.org,
	Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Subject: [PATCH] watchdog: gef_wdt:  Fix an error handling path in 'gef_wdt_probe()'
Date: Sun,  6 Jun 2021 16:49:18 +0200	[thread overview]
Message-ID: <3d775a5ac7e26fa5dd4c47f75fef6d5f336de1e3.1622990863.git.christophe.jaillet@wanadoo.fr> (raw)

If an error occurs after a successful 'of_iomap()' call, it must be undone
by a corresponding 'iounmap()' call, as already done in the remove
function.

Fixes: 3268b5618f38 ("[WATCHDOG] Basic support for GE Fanuc's FPGA based watchdog timer")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/watchdog/gef_wdt.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/watchdog/gef_wdt.c b/drivers/watchdog/gef_wdt.c
index df5406aa7d25..52573176101f 100644
--- a/drivers/watchdog/gef_wdt.c
+++ b/drivers/watchdog/gef_wdt.c
@@ -264,6 +264,7 @@ static int gef_wdt_probe(struct platform_device *dev)
 {
 	int timeout = 10;
 	u32 freq;
+	int ret;
 
 	bus_clk = 133; /* in MHz */
 
@@ -280,7 +281,15 @@ static int gef_wdt_probe(struct platform_device *dev)
 
 	gef_wdt_handler_disable();	/* in case timer was already running */
 
-	return misc_register(&gef_wdt_miscdev);
+	ret = misc_register(&gef_wdt_miscdev);
+	if (ret)
+		goto iounmap_err;
+
+	return 0;
+
+iounmap_err:
+	iounmap(gef_wdt_regs);
+	return ret;
 }
 
 static int gef_wdt_remove(struct platform_device *dev)
-- 
2.30.2


             reply	other threads:[~2021-06-06 14:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-06 14:49 Christophe JAILLET [this message]
2021-06-07  1:22 ` [PATCH] watchdog: gef_wdt: Fix an error handling path in 'gef_wdt_probe()' Guenter Roeck

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=3d775a5ac7e26fa5dd4c47f75fef6d5f336de1e3.1622990863.git.christophe.jaillet@wanadoo.fr \
    --to=christophe.jaillet@wanadoo.fr \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=martyn.welch@gefanuc.com \
    --cc=wim@linux-watchdog.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;
as well as URLs for NNTP newsgroup(s).