Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1547932

[PATCH v2 2/3] PM / devfreq: Fix the bug of devfreq_add_device when governor is NULL

From Chanwoo Choi <cw00.choi@samsung.com>
Newsgroups linux.kernel
Subject [PATCH v2 2/3] PM / devfreq: Fix the bug of devfreq_add_device when governor is NULL
Date 2016-12-28 13:00 +0100
Message-ID <sTl3I-7Id-49@gated-at.bofh.it> (permalink)
References <sTl3H-7Id-3@gated-at.bofh.it> <sTl3I-7Id-51@gated-at.bofh.it> <sTl3H-7Id-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


This patch fixes the bug of devfreq_add_device(). The devfreq device must
have the default governor. If find_devfreq_governor() returns error,
devfreq_add_device() fail to add the devfreq instance.

Fixes: 1b5c1be2c88e ("PM / devfreq: map devfreq drivers to governor using name")
Cc: stable@vger.kernel.org
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
---
 drivers/devfreq/devfreq.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
index a324801d6a66..47206a21bb90 100644
--- a/drivers/devfreq/devfreq.c
+++ b/drivers/devfreq/devfreq.c
@@ -593,11 +593,16 @@ struct devfreq *devfreq_add_device(struct device *dev,
 	list_add(&devfreq->node, &devfreq_list);
 
 	governor = find_devfreq_governor(devfreq->governor_name);
-	if (!IS_ERR(governor))
-		devfreq->governor = governor;
-	if (devfreq->governor)
-		err = devfreq->governor->event_handler(devfreq,
-					DEVFREQ_GOV_START, NULL);
+	if (IS_ERR(governor)) {
+		dev_err(dev, "%s: Unable to find governor for the device\n",
+			__func__);
+		err = PTR_ERR(governor);
+		goto err_init;
+	}
+
+	devfreq->governor = governor;
+	err = devfreq->governor->event_handler(devfreq, DEVFREQ_GOV_START,
+						NULL);
 	if (err) {
 		dev_err(dev, "%s: Unable to start governor for the device\n",
 			__func__);
-- 
1.9.1

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 0/3] PM / devfreq: Fix the bug and add reviewer for devfreq  support Chanwoo Choi <cw00.choi@samsung.com> - 2016-12-28 13:00 +0100
  [PATCH v2 2/3] PM / devfreq: Fix the bug of devfreq_add_device when  governor is NULL Chanwoo Choi <cw00.choi@samsung.com> - 2016-12-28 13:00 +0100
  Re: [PATCH v2 0/3] PM / devfreq: Fix the bug and add reviewer for  devfreq support Chanwoo Choi <cwchoi00@gmail.com> - 2017-01-03 13:00 +0100

csiph-web