public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] watchdog: fix clk_get() error check
@ 2006-12-19  8:51 Akinobu Mita
  2006-12-19 10:43 ` Ben Dooks
  2006-12-19 21:20 ` Wim Van Sebroeck
  0 siblings, 2 replies; 4+ messages in thread
From: Akinobu Mita @ 2006-12-19  8:51 UTC (permalink / raw)
  To: linux-kernel; +Cc: Wim Van Sebroeck, Ben Dooks, Dimitry Andric

The return value of clk_get() should be checked by IS_ERR().

Cc: Wim Van Sebroeck <wim@iguana.be>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>

---
 drivers/char/watchdog/pnx4008_wdt.c |    3 ++-
 drivers/char/watchdog/s3c2410_wdt.c |    4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)

Index: 2.6-mm/drivers/char/watchdog/pnx4008_wdt.c
===================================================================
--- 2.6-mm.orig/drivers/char/watchdog/pnx4008_wdt.c
+++ 2.6-mm/drivers/char/watchdog/pnx4008_wdt.c
@@ -283,7 +283,8 @@ static int pnx4008_wdt_probe(struct plat
 	wdt_base = (void __iomem *)IO_ADDRESS(res->start);
 
 	wdt_clk = clk_get(&pdev->dev, "wdt_ck");
-	if (!wdt_clk) {
+	if (IS_ERR(wdt_clk)) {
+		ret = PTR_ERR(wdt_clk);
 		release_resource(wdt_mem);
 		kfree(wdt_mem);
 		goto out;
Index: 2.6-mm/drivers/char/watchdog/s3c2410_wdt.c
===================================================================
--- 2.6-mm.orig/drivers/char/watchdog/s3c2410_wdt.c
+++ 2.6-mm/drivers/char/watchdog/s3c2410_wdt.c
@@ -392,10 +392,10 @@ static int s3c2410wdt_probe(struct platf
 	}
 
 	wdt_clock = clk_get(&pdev->dev, "watchdog");
-	if (wdt_clock == NULL) {
+	if (IS_ERR(wdt_clock)) {
 		printk(KERN_INFO PFX "failed to find watchdog clock source\n");
 		iounmap(wdt_base);
-		return -ENOENT;
+		return PTR_ERR(wdt_clock);
 	}
 
 	clk_enable(wdt_clock);

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

* Re: [PATCH] watchdog: fix clk_get() error check
  2006-12-19  8:51 [PATCH] watchdog: fix clk_get() error check Akinobu Mita
@ 2006-12-19 10:43 ` Ben Dooks
  2006-12-19 21:22   ` Wim Van Sebroeck
  2006-12-19 21:20 ` Wim Van Sebroeck
  1 sibling, 1 reply; 4+ messages in thread
From: Ben Dooks @ 2006-12-19 10:43 UTC (permalink / raw)
  To: Akinobu Mita, linux-kernel, Wim Van Sebroeck, Ben Dooks,
	Dimitry Andric

On Tue, Dec 19, 2006 at 05:51:44PM +0900, Akinobu Mita wrote:
> The return value of clk_get() should be checked by IS_ERR().

thanks for spotting this, but this will probably clash with
a cleanup patch I sent a day or two ago to streamline the
exit path in the driver.

see http://lkml.org/lkml/2006/12/18/65

-- 
Ben

Q:      What's a light-year?
A:      One-third less calories than a regular year.


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

* Re: [PATCH] watchdog: fix clk_get() error check
  2006-12-19  8:51 [PATCH] watchdog: fix clk_get() error check Akinobu Mita
  2006-12-19 10:43 ` Ben Dooks
@ 2006-12-19 21:20 ` Wim Van Sebroeck
  1 sibling, 0 replies; 4+ messages in thread
From: Wim Van Sebroeck @ 2006-12-19 21:20 UTC (permalink / raw)
  To: Akinobu Mita, linux-kernel, Ben Dooks, Dimitry Andric

Hi Akinobu,

> The return value of clk_get() should be checked by IS_ERR().

Modified patch added to linux-2.6-watchdog-mm git tree.
(I needed to modify the s3c2410_wdt.c part since because of the
changes we added yesterday).

Greetings,
Wim.


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

* Re: [PATCH] watchdog: fix clk_get() error check
  2006-12-19 10:43 ` Ben Dooks
@ 2006-12-19 21:22   ` Wim Van Sebroeck
  0 siblings, 0 replies; 4+ messages in thread
From: Wim Van Sebroeck @ 2006-12-19 21:22 UTC (permalink / raw)
  To: Ben Dooks; +Cc: Akinobu Mita, linux-kernel, Ben Dooks, Dimitry Andric

Hi Ben,

> On Tue, Dec 19, 2006 at 05:51:44PM +0900, Akinobu Mita wrote:
> > The return value of clk_get() should be checked by IS_ERR().
> 
> thanks for spotting this, but this will probably clash with
> a cleanup patch I sent a day or two ago to streamline the
> exit path in the driver.
> 
> see http://lkml.org/lkml/2006/12/18/65

It did, but I modified it slightly so that it worked with your
previous patch also. Can you test below patch?

Thanks,
Wim.

--- 2.6-mm.orig/drivers/char/watchdog/s3c2410_wdt.c
+++ 2.6-mm/drivers/char/watchdog/s3c2410_wdt.c
@@ -393,9 +393,9 @@
 	}
 
 	wdt_clock = clk_get(&pdev->dev, "watchdog");
-	if (wdt_clock == NULL) {
+	if (IS_ERR(wdt_clock)) {
 		printk(KERN_INFO PFX "failed to find watchdog clock source\n");
-		ret =  -ENOENT;
+		ret = PTR_ERR(wdt_clock);
 		goto err_irq;
 	}
 

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

end of thread, other threads:[~2006-12-19 21:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-12-19  8:51 [PATCH] watchdog: fix clk_get() error check Akinobu Mita
2006-12-19 10:43 ` Ben Dooks
2006-12-19 21:22   ` Wim Van Sebroeck
2006-12-19 21:20 ` Wim Van Sebroeck

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