From patchwork Wed Dec 28 11:52:35 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chanwoo Choi X-Patchwork-Id: 9490237 X-Patchwork-Delegate: rjw@sisk.pl Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 44DDD62AB0 for ; Wed, 28 Dec 2016 11:54:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2F65E1FF1E for ; Wed, 28 Dec 2016 11:54:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2451E26246; Wed, 28 Dec 2016 11:54:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DC5D81FF1E for ; Wed, 28 Dec 2016 11:54:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751353AbcL1LyT (ORCPT ); Wed, 28 Dec 2016 06:54:19 -0500 Received: from mailout1.samsung.com ([203.254.224.24]:33003 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751352AbcL1Lxd (ORCPT ); Wed, 28 Dec 2016 06:53:33 -0500 Received: from epcas1p4.samsung.com (unknown [182.195.41.48]) by mailout1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OIW00A268ZU5S50@mailout1.samsung.com>; Wed, 28 Dec 2016 20:52:42 +0900 (KST) Received: from epsmges5p2.samsung.com (unknown [182.195.40.65]) by epcas1p1.samsung.com (KnoxPortal) with ESMTP id 20161228115241epcas1p1e95b4571fae148ceb76ec922c509d959~UaU4qKZSs1604816048epcas1p16; Wed, 28 Dec 2016 11:52:41 +0000 (GMT) Received: from epcas5p2.samsung.com ( [182.195.41.40]) by epsmges5p2.samsung.com (EPCPMTA) with SMTP id F4.BB.29876.987A3685; Wed, 28 Dec 2016 20:52:41 +0900 (KST) Received: from epcpsbgm2new.samsung.com (u27.gpu120.samsung.co.kr [203.254.230.27]) by epcas5p4.samsung.com (KnoxPortal) with ESMTP id 20161228115241epcas5p488b90c45e4f8c4189f18ceaf464fecd7~UaU4UnjUK0150101501epcas5p4L; Wed, 28 Dec 2016 11:52:41 +0000 (GMT) X-AuditID: b6c32a2d-f79a76d0000074b4-4f-5863a789b1bc Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2new.samsung.com (EPCPMTA) with SMTP id 52.A0.28332.987A3685; Wed, 28 Dec 2016 20:52:41 +0900 (KST) Received: from localhost.localdomain ([10.113.62.212]) by mmp1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OIW009GW8ZSI400@mmp1.samsung.com>; Wed, 28 Dec 2016 20:52:41 +0900 (KST) From: Chanwoo Choi To: myungjoo.ham@samsung.com, kyungmin.park@samsung.com Cc: chanwoo@kernel.org, rjw@rjwysocki.net, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Chanwoo Choi , stable@vger.kernel.org Subject: [PATCH v2 2/3] PM / devfreq: Fix the bug of devfreq_add_device when governor is NULL Date: Wed, 28 Dec 2016 20:52:35 +0900 Message-id: <1482925956-19044-3-git-send-email-cw00.choi@samsung.com> X-Mailer: git-send-email 1.8.0 In-reply-to: <1482925956-19044-1-git-send-email-cw00.choi@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrIKsWRmVeSWpSXmKPExsWy7bCmhm7n8uQIgztftSwm3rjCYnH9y3NW i7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XN41h83ic+8RRovbjSvYLM6cvsRqsWDjI0YHDo9NqzrZPLZcbWfx6NuyitHj8ya5 AJYoN5uM1MSU1CKF1Lzk/JTMvHRbpdAQN10LJYW8xNxUW6UIXd+QICWFssScUiDPyAANODgH uAcr6dsluGVc+32TueArV8XXmU+YGxgncXYxcnJICJhIXFizlhHCFpO4cG89WxcjF4eQwFJG iYs3DrODJIQEfjBK3H3oDmKzCWhJ7H9xgw3EFhEwl9i19CeYzSywmFFizgcVEFtYIF5i0o61 rF2MHBwsAqoSTzuCQMK8Aq4Sj3evZoXYJSfxYc8jsPGcAm4Sm188YQQpFwKqWdXJMYGRdwEj wypGidSC5ILipPRco7zUcr3ixNzi0rx0veT83E2M4HB+Jr2D8fAu90OMAhyMSjy8AdeSIoRY E8uKK3MPMUpwMCuJ8MYtS44Q4k1JrKxKLcqPLyrNSS0+xGgKdNZEZinR5HxgrOWVxBuamJuY GxtYmFtamhgpifM2zn4WLiSQnliSmp2aWpBaBNPHxMEp1cCYcVm3Vddo6b1j4ivY/ros/O2Z uZNjo+PLgwbFkofenjd6c+TxGvNPDQY93i43/urPt//1Y4ZKqdMszYje1cZKG81fhAktVFtl 80TYaV/JwZ2HU7SD3p2/XqfZfmHWOYsDugsKVFytw297M8xs8GhbquW0QCY5/309Y27sx4nb brVw6Mw4EGamxFKckWioxVxUnAgAKOLL2X0CAAA= X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20161228115241epcas5p488b90c45e4f8c4189f18ceaf464fecd7 X-Msg-Generator: CA X-Sender-IP: 203.254.230.27 X-Local-Sender: =?UTF-8?B?7LWc7LCs7JqwG1RpemVuIFBsYXRmb3JtIExhYihTL1fshLw=?= =?UTF-8?B?7YSwKRvsgrzshLHsoITsnpAbUzUo7LGF7J6EKS9DaGFuZ2UgQWdlbnQ=?= X-Global-Sender: =?UTF-8?B?Q2hhbndvbyBDaG9pG1RpemVuIFBsYXRmb3JtIExhYi4bU2Ft?= =?UTF-8?B?c3VuZyBFbGVjdHJvbmljcxtTNS9TZW5pb3IgRW5naW5lZXI=?= X-Sender-Code: =?UTF-8?B?QzEwG1NUQUYbQzEwVjgxMTE=?= CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-HopCount: 7 X-CMS-RootMailID: 20161228115241epcas5p488b90c45e4f8c4189f18ceaf464fecd7 X-RootMTR: 20161228115241epcas5p488b90c45e4f8c4189f18ceaf464fecd7 References: <1482925956-19044-1-git-send-email-cw00.choi@samsung.com> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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__);