public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Wei Yongjun <weiyongjun1@huawei.com>
Cc: MyungJoo Ham <myungjoo.ham@samsung.com>,
	Kyungmin Park <kyungmin.park@samsung.com>,
	Chanwoo Choi <cw00.choi@samsung.com>,
	linux-pm@vger.kernel.org, kernel-janitors@vger.kernel.org,
	Hulk Robot <hulkci@huawei.com>
Subject: Re: [PATCH -next] PM / devfreq: Fix missing unlock on error in devfreq_add_device()
Date: Tue, 14 Jul 2020 13:59:18 +0300	[thread overview]
Message-ID: <20200714105918.GB2571@kadam> (raw)
In-Reply-To: <20200714093758.GW2549@kadam>

On Tue, Jul 14, 2020 at 12:37:58PM +0300, Dan Carpenter wrote:
> On Tue, Jul 14, 2020 at 06:30:25AM +0000, Wei Yongjun wrote:
> > Add the missing unlock before return from function devfreq_add_device()
> > in the error handling case.
> > 
> > Fixes: d7c46505a7ad ("PM / devfreq: Add support delayed timer for polling mode")
> > Reported-by: Hulk Robot <hulkci@huawei.com>
> > Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
> > ---
> >  drivers/devfreq/devfreq.c | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
> > index 5320c3b37f35..2b54a59bb281 100644
> > --- a/drivers/devfreq/devfreq.c
> > +++ b/drivers/devfreq/devfreq.c
> > @@ -788,6 +788,7 @@ struct devfreq *devfreq_add_device(struct device *dev,
> >  
> >  	if (devfreq->profile->timer < 0
> >  		|| devfreq->profile->timer >= DEVFREQ_TIMER_NUM) {
> > +		mutex_unlock(&devfreq->lock);
> >  		goto err_out;
> 
> This should be "goto err_dev;" and the unlock is not required because
> we free "devfreq".

Also the error code needs to be set on this error path.

regards,
dan carpenter


      reply	other threads:[~2020-07-14 10:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-14  6:30 [PATCH -next] PM / devfreq: Fix missing unlock on error in devfreq_add_device() Wei Yongjun
2020-07-14  9:37 ` Dan Carpenter
2020-07-14 10:59   ` Dan Carpenter [this message]

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=20200714105918.GB2571@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=cw00.choi@samsung.com \
    --cc=hulkci@huawei.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-pm@vger.kernel.org \
    --cc=myungjoo.ham@samsung.com \
    --cc=weiyongjun1@huawei.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox