[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140507082410.GC6362@ulmo>
Date: Wed, 7 May 2014 10:24:11 +0200
From: Thierry Reding <thierry.reding@...il.com>
To: Viresh Kumar <viresh.kumar@...aro.org>
Cc: Beniamino Galvani <b.galvani@...il.com>, linux-pwm@...r.kernel.org,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] pwm: spear: fix check on pwmchip_add() return value
On Wed, May 07, 2014 at 11:37:25AM +0530, Viresh Kumar wrote:
> On Tue, May 6, 2014 at 2:59 AM, Beniamino Galvani <b.galvani@...il.com> wrote:
> > pwmchip_add() returns zero on success and a negative value on error,
> > so the condition of the check must be inverted.
> >
> > Signed-off-by: Beniamino Galvani <b.galvani@...il.com>
> > ---
> > drivers/pwm/pwm-spear.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/pwm/pwm-spear.c b/drivers/pwm/pwm-spear.c
> > index cb2d4f0..945556d 100644
> > --- a/drivers/pwm/pwm-spear.c
> > +++ b/drivers/pwm/pwm-spear.c
> > @@ -222,7 +222,7 @@ static int spear_pwm_probe(struct platform_device *pdev)
> > }
> >
> > ret = pwmchip_add(&pc->chip);
> > - if (!ret) {
> > + if (ret < 0) {
> > clk_unprepare(pc->clk);
> > dev_err(&pdev->dev, "pwmchip_add() failed: %d\n", ret);
> > }
So the current code would run clk_unprepare() on success, but not on
failure. Does that cause any harm? Is the device still usable after
this? I'm asking because I'm not sure if this is linux-next material
or should be a fix for 3.15 (and possibly backported to stable).
Thierry
Content of type "application/pgp-signature" skipped
Powered by blists - more mailing lists