--- a/drivers/devfreq/devfreq.c +++ b/drivers/devfreq/devfreq.c @@ -818,7 +818,8 @@ struct devfreq *devfreq_add_device(struc if (devfreq->profile->timer < 0 || devfreq->profile->timer >= DEVFREQ_TIMER_NUM) { - goto err_out; + mutex_unlock(&devfreq->lock); + goto err_dev; } if (!devfreq->profile->max_state && !devfreq->profile->freq_table) {