PM / devfreq: Skip status update on uninitialized previous_freq
authorTobias Jakobi <tjakobi@math.uni-bielefeld.de>
Thu, 29 Sep 2016 12:36:36 +0000 (14:36 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Mon, 10 Oct 2016 22:01:20 +0000 (00:01 +0200)
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>
Acked-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/devfreq/devfreq.c

index 66d3c7184a0f0cfaf568879088d7bc3b6f584fc1..bf3ea7603a58a9705d51feb271a61507f5c779e9 100644 (file)
@@ -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;