[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20160517131147.7f505f2b@bbrezillon>
Date: Tue, 17 May 2016 13:11:47 +0200
From: Boris Brezillon <boris.brezillon@...e-electrons.com>
To: Thierry Reding <thierry.reding@...il.com>
Cc: linux-pwm@...r.kernel.org,
Mika Penttilä <mika.penttila@...tfour.com>,
linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
Daniel Mack <daniel@...que.org>,
Haojian Zhuang <haojian.zhuang@...il.com>,
Robert Jarzmik <robert.jarzmik@...e.fr>
Subject: Re: [PATCH] pwm: Fill pwm->args before calling
pwm_request_from_chip()
On Tue, 17 May 2016 13:04:38 +0200
Thierry Reding <thierry.reding@...il.com> wrote:
> On Tue, May 17, 2016 at 12:35:33PM +0200, Boris Brezillon wrote:
> [...]
> > diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c
> > index 427142d..3d2eeaa 100644
> > --- a/drivers/pwm/core.c
> > +++ b/drivers/pwm/core.c
> > @@ -143,10 +143,6 @@ of_pwm_xlate_with_flags(struct pwm_chip *pc, const struct of_phandle_args *args)
> > if (args->args[0] >= pc->npwm)
> > return ERR_PTR(-EINVAL);
> >
> > - pwm = pwm_request_from_chip(pc, args->args[0], NULL);
> > - if (IS_ERR(pwm))
> > - return pwm;
> > -
> > pwm->args.period = args->args[1];
> >
> > if (args->args[2] & PWM_POLARITY_INVERTED)
> > @@ -154,6 +150,10 @@ of_pwm_xlate_with_flags(struct pwm_chip *pc, const struct of_phandle_args *args)
> > else
> > pwm->args.polarity = PWM_POLARITY_NORMAL;
> >
> > + pwm = pwm_request_from_chip(pc, args->args[0], NULL);
> > + if (IS_ERR(pwm))
> > + return pwm;
> > +
>
> Can't do that, because now you're dereferencing an uninitialized
> pointer.
Yes, forget this patch, it's not needed anyway since all PWM users are
now directly calling pwm_apply_args() after requesting the PWM. The bad
news is I broke bisectibilty :-(.
Still does not explain the bug reported by Mika.
--
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
Powered by blists - more mailing lists