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@xxxxxxxxxx> > > Signed-off-by: Wei Yongjun <weiyongjun1@xxxxxxxxxx> > > --- > > 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