diff mbox

PM / devfreq: Skip status update on uninitialized previous_freq

Message ID 1475152596-7892-1-git-send-email-tjakobi@math.uni-bielefeld.de (mailing list archive)
State Accepted, archived
Delegated to: Rafael Wysocki
Headers show

Commit Message

Tobias Jakobi Sept. 29, 2016, 12:36 p.m. UTC
In case devfreq->previous_freq is still uninitialized in
devfreq_update_status(), i.e. it has value '0', the lookups in
that function fail, eventually leading to some error message:
[    3.041292] devfreq bus_dmc: Couldn't update frequency transition information.

Just skip the statup update in this situation.

Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
---
 drivers/devfreq/devfreq.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

MyungJoo Ham Sept. 30, 2016, 2:09 p.m. UTC | #1
On Thu, Sep 29, 2016 at 9:36 PM, Tobias Jakobi
<tjakobi@math.uni-bielefeld.de> wrote:
> In case devfreq->previous_freq is still uninitialized in
> devfreq_update_status(), i.e. it has value '0', the lookups in
> that function fail, eventually leading to some error message:
> [    3.041292] devfreq bus_dmc: Couldn't update frequency transition information.
>
> Just skip the statup update in this situation.
>
> Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
> ---
>  drivers/devfreq/devfreq.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
> index 478006b..1bb300f 100644
> --- a/drivers/devfreq/devfreq.c
> +++ b/drivers/devfreq/devfreq.c
> @@ -137,6 +137,10 @@ static int devfreq_update_status(struct devfreq *devfreq, unsigned long freq)
>
>         cur_time = jiffies;
>
> +       /* Immediately exit if previous_freq is not initialized yet. */
> +       if (!devfreq->previous_freq)
> +               goto out;
> +

Thanks!


Acked-by: MyungJoo Ham <myungjoo.ham@samsung.com>


Cheers,
MyungJoo

>         prev_lev = devfreq_get_freq_level(devfreq, devfreq->previous_freq);
>         if (prev_lev < 0) {
>                 ret = prev_lev;
> --
> 2.7.3
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
Rafael J. Wysocki Oct. 12, 2016, 8:11 p.m. UTC | #2
On Friday, September 30, 2016 11:09:34 PM MyungJoo Ham wrote:
> On Thu, Sep 29, 2016 at 9:36 PM, Tobias Jakobi
> <tjakobi@math.uni-bielefeld.de> wrote:
> > In case devfreq->previous_freq is still uninitialized in
> > devfreq_update_status(), i.e. it has value '0', the lookups in
> > that function fail, eventually leading to some error message:
> > [    3.041292] devfreq bus_dmc: Couldn't update frequency transition information.
> >
> > Just skip the statup update in this situation.
> >
> > Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
> > ---
> >  drivers/devfreq/devfreq.c | 4 ++++
> >  1 file changed, 4 insertions(+)
> >
> > diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
> > index 478006b..1bb300f 100644
> > --- a/drivers/devfreq/devfreq.c
> > +++ b/drivers/devfreq/devfreq.c
> > @@ -137,6 +137,10 @@ static int devfreq_update_status(struct devfreq *devfreq, unsigned long freq)
> >
> >         cur_time = jiffies;
> >
> > +       /* Immediately exit if previous_freq is not initialized yet. */
> > +       if (!devfreq->previous_freq)
> > +               goto out;
> > +
> 
> Thanks!
> 
> 
> Acked-by: MyungJoo Ham <myungjoo.ham@samsung.com>

Applied.

Thanks,
Rafael

--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
index 478006b..1bb300f 100644
--- a/drivers/devfreq/devfreq.c
+++ b/drivers/devfreq/devfreq.c
@@ -137,6 +137,10 @@  static int devfreq_update_status(struct devfreq *devfreq, unsigned long freq)
 
 	cur_time = jiffies;
 
+	/* Immediately exit if previous_freq is not initialized yet. */
+	if (!devfreq->previous_freq)
+		goto out;
+
 	prev_lev = devfreq_get_freq_level(devfreq, devfreq->previous_freq);
 	if (prev_lev < 0) {
 		ret = prev_lev;