kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] watchdog: gef_wdt:  Fix an error handling path in 'gef_wdt_probe()'
@ 2021-06-06 14:49 Christophe JAILLET
  2021-06-07  1:22 ` Guenter Roeck
  0 siblings, 1 reply; 2+ messages in thread
From: Christophe JAILLET @ 2021-06-06 14:49 UTC (permalink / raw)
  To: wim, linux, martyn.welch
  Cc: linux-watchdog, linux-kernel, kernel-janitors, Christophe JAILLET

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


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

* Re: [PATCH] watchdog: gef_wdt:  Fix an error handling path in 'gef_wdt_probe()'
  2021-06-06 14:49 [PATCH] watchdog: gef_wdt: Fix an error handling path in 'gef_wdt_probe()' Christophe JAILLET
@ 2021-06-07  1:22 ` Guenter Roeck
  0 siblings, 0 replies; 2+ messages in thread
From: Guenter Roeck @ 2021-06-07  1:22 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: wim, martyn.welch, linux-watchdog, linux-kernel, kernel-janitors

On Sun, Jun 06, 2021 at 04:49:18PM +0200, Christophe JAILLET wrote:
> 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>

<Formletter>  
Please do not submit patches for old-style watchdog drivers unless you
have access to the hardware. If you do have access to the hardware, please
convert the driver to a new-style watchdog driver. I'll be happy to assist
with the conversion if necessary.
</Formletter>

Thanks,
Guenter

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

end of thread, other threads:[~2021-06-07  1:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-06 14:49 [PATCH] watchdog: gef_wdt: Fix an error handling path in 'gef_wdt_probe()' Christophe JAILLET
2021-06-07  1:22 ` Guenter Roeck

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