lkml.org 
[lkml]   [2011]   [Jan]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 07/16] staging: tidspbridge: don't treat NULL clk as an error
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@ti.com>
> Cc: Greg Kroah-Hartman <gregkh@suse.de>
> Signed-off-by: Jamie Iles <jamie@jamieiles.com>
> ---
> 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@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>


\
 
 \ /
  Last update: 2011-01-11 16:53    [W:0.223 / U:0.812 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site