From: MyungJoo Ham Date: Mon, 23 Nov 2015 06:45:36 +0000 (+0900) Subject: PM / devfreq: Do not show statistics if it's not ready. X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=34bd322070a41898b032f59a0dfd345627fc1e7e;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git PM / devfreq: Do not show statistics if it's not ready. Before this patch for a device without statistics support, $ cat trans_stat From : To : time(ms) Total transitions : 0 $ After this patch applied for such a device, $ cat trans_stat Not Supported. $ Signed-off-by: MyungJoo Ham --- diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c index d36fa2db4d29..984c5e9e7bdd 100644 --- a/drivers/devfreq/devfreq.c +++ b/drivers/devfreq/devfreq.c @@ -1049,6 +1049,8 @@ static ssize_t trans_stat_show(struct device *dev, if (!devfreq->stop_polling && devfreq_update_status(devfreq, devfreq->previous_freq)) return 0; + if (max_state == 0) + return sprintf(buf, "Not Supported.\n"); len = sprintf(buf, " From : To\n"); len += sprintf(buf + len, " :");