From 5809cdffe4c6a50f4d5b8b24bf2de2f1a5c617cf Mon Sep 17 00:00:00 2001 From: MyungJoo Ham Date: Mon, 23 Nov 2015 15:45:36 +0900 Subject: [PATCH] UPSTREAM: 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 (cherry picked from commit 34bd322070a41898b032f59a0dfd345627fc1e7e) Change-Id: Iae8a0e839cdd9b6d2e1c5c1332d85796b928f535 Signed-off-by: Finley Xiao --- drivers/devfreq/devfreq.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c index e535bdffb25c..c2cdfe7d8377 100644 --- a/drivers/devfreq/devfreq.c +++ b/drivers/devfreq/devfreq.c @@ -1138,6 +1138,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, " :");