Re: [PATCH 07/16] staging: tidspbridge: don't treat NULL clk as anerror

From: Aaro Koskinen
Date: Tue Jan 11 2011 - 10:51:01 EST


Hi,

On Tue, 11 Jan 2011, Jamie Iles wrote:
clk_get() returns a struct clk cookie to the driver and some platforms
may return NULL if they only support a single clock. clk_get() has only
failed if it returns a ERR_PTR() encoded pointer.

Cc: Omar Ramirez Luna <omar.ramirez@xxxxxx>
Cc: Greg Kroah-Hartman <gregkh@xxxxxxx>
Signed-off-by: Jamie Iles <jamie@xxxxxxxxxxxxx>
---
drivers/staging/tidspbridge/core/wdt.c | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/tidspbridge/core/wdt.c b/drivers/staging/tidspbridge/core/wdt.c
index 2126f59..bfbf88d 100644
--- a/drivers/staging/tidspbridge/core/wdt.c
+++ b/drivers/staging/tidspbridge/core/wdt.c
@@ -15,6 +15,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
+#include <linux/err.h>
#include <linux/types.h>

#include <dspbridge/dbdefs.h>
@@ -60,15 +61,15 @@ int dsp_wdt_init(void)

dsp_wdt.fclk = clk_get(NULL, "wdt3_fck");

- if (dsp_wdt.fclk) {
+ if (!IS_ERR(dsp_wdt.fclk)) {
dsp_wdt.iclk = clk_get(NULL, "wdt3_ick");
- if (!dsp_wdt.iclk) {
+ if (IS_ERR(dsp_wdt.iclk)) {
clk_put(dsp_wdt.fclk);
dsp_wdt.fclk = NULL;
- ret = -EFAULT;
+ ret = PTR_ERR(dsp_wdt.iclk);
}
} else
- ret = -EFAULT;
+ ret = PTR_ERR(dsp_wdt.fclk);

There are also other places in this driver where dsp_wdt.[if]clk is
checked against NULL, so this change alone is not sufficient.


if (!ret)
ret = request_irq(INT_34XX_WDT3_IRQ, dsp_wdt_isr, 0,
--
1.7.3.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/