All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>,
	Thierry Reding <thierry.reding@gmail.com>,
	Linux PWM List <linux-pwm@vger.kernel.org>,
	Linux-Renesas <linux-renesas-soc@vger.kernel.org>,
	Phong Hoang <phong.hoang.wz@renesas.com>
Subject: Re: [PATCH] pwm: Avoid deadlock warning when removing PWM device
Date: Tue, 12 Mar 2019 10:54:33 +0100	[thread overview]
Message-ID: <20190312095433.fl2nbbj3jsqxhcny@pengutronix.de> (raw)
In-Reply-To: <CAMuHMdUYqk6nFAd2TQ_xM9q3bHskpd8vZXJ8DiF3tFwJQLc=tg@mail.gmail.com>

On Tue, Mar 12, 2019 at 10:49:59AM +0100, Geert Uytterhoeven wrote:
> Hi Uwe,
> 
> On Tue, Mar 12, 2019 at 10:23 AM Uwe Kleine-König
> <u.kleine-koenig@pengutronix.de> wrote:
> > On Tue, Mar 12, 2019 at 12:16:34PM +0900, Yoshihiro Shimoda wrote:
> > > diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c
> > > index 1581f6a..2fdd6611 100644
> > > --- a/drivers/pwm/core.c
> > > +++ b/drivers/pwm/core.c
> 
> > > @@ -368,10 +370,12 @@ int pwmchip_remove(struct pwm_chip *chip)
> > >
> > >       free_pwms(chip);
> > >
> > > -     pwmchip_sysfs_unexport(chip);
> > > -
> > >  out:
> > >       mutex_unlock(&pwm_lock);
> > > +
> > > +     if (!ret)
> > > +             pwmchip_sysfs_unexport(chip);
> > > +
> >
> > I wonder if this needs to be done before free_pwms is called. Otherwise
> > the pwmchip is already gone and then something is requested via sysfs.
> 
> The chip itself is not freed, only the pwms array inside, which is not needed
> for matching in pwmchip_sysfs_unexport(), right?

OK, then make this:

I wonder if pwmchip_sysfs_unexport needs to be done before free_pwms is
called. Otherwise the PWMs's representation is already gone and then
something might be requested via sysfs.
 
Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

  reply	other threads:[~2019-03-12  9:54 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-12  3:16 [PATCH] pwm: Avoid deadlock warning when removing PWM device Yoshihiro Shimoda
2019-03-12  8:38 ` Geert Uytterhoeven
2019-03-12  9:23 ` Uwe Kleine-König
2019-03-12  9:49   ` Geert Uytterhoeven
2019-03-12  9:54     ` Uwe Kleine-König [this message]
2019-03-12 11:47       ` Thierry Reding
2019-03-12 11:54 ` Thierry Reding
2019-03-12 12:09   ` Geert Uytterhoeven
2019-03-12 12:45 ` Thierry Reding
2019-03-13  7:01   ` Yoshihiro Shimoda
2019-03-13  7:01     ` Yoshihiro Shimoda

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190312095433.fl2nbbj3jsqxhcny@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --cc=geert@linux-m68k.org \
    --cc=linux-pwm@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=phong.hoang.wz@renesas.com \
    --cc=thierry.reding@gmail.com \
    --cc=yoshihiro.shimoda.uh@renesas.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.