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

From: Jamie Iles
Date: Tue Jan 11 2011 - 11:40:41 EST


Hi Aaro,

On Tue, Jan 11, 2011 at 05:50:06PM +0200, Aaro Koskinen wrote:
> On Tue, 11 Jan 2011, Jamie Iles wrote:
[...]
> >#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.

Yes, you're quite right.

On closer inspection it looks to me like the error handling in
drivers/staging/tidspbridge/io_sm.c::bridge_io_create needs to be fixed
up first otherwise we can end up calling dsp_wdt_exit() through
bridge_io_destroy() without the contents of dsp_wdt being coherently
initialized (there are also failure paths where the wdt irq and tasklet
can be freed/killed without first being setup).

Jamie
--
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/