Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp345061pxu; Wed, 25 Nov 2020 04:53:13 -0800 (PST) X-Google-Smtp-Source: ABdhPJxsqdoe7u/dFbGdAEPG17n+ehgjMDYY3HJf118KCQBqsscQ7FrXbjjcwM1sx0LvTHNy2sB6 X-Received: by 2002:a50:e8c7:: with SMTP id l7mr3392686edn.356.1606308793386; Wed, 25 Nov 2020 04:53:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606308793; cv=none; d=google.com; s=arc-20160816; b=hDrrk+RykawDNbAa7ERmMOUrCacEDza5+gOKEtLipQRNZcKjM/UngIIcq3+E38T5J8 GNNP7SQTAXCz3fHXjYjKoXuJ2UvSAxDL7/ggdL/Hi/xCZAAjUYhk7EF6C4rhF2AYzuxM lEqCQ78eNM1X+EmMJx34u3EvVkNwTC0v5Om1uETzRqKiZ+ZUtCF0XMZ2i7B5iUvugiZ2 Whc5xg/s/G9n1VfQwH8FvzXo6cYUZTjjxSxitAz/iLY+DVqbReUUJ1s2rGDzbJpCgtB7 1XbZcSFdXxZQo+ACecFdosk7Ml8LBM8QsVe5H2yqrIb6CYFRkvapomdN3QKrf1Al4R9B dkdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=09mFSYC5ni65VdSABRsCgRhVgRvXiE7RtuA8lUIujn4=; b=q731lCx9W0pkGvEb1I4wDYH5jNL2Rlk+fyA/ilgDBs/TI6p0/DxwDN544qIY+fyoEl fgKj8ZWbWy6nb11/aaLjWiulEaexz/TCjm83bxko3CjdU0bdVP404K5+fg+rtm09iuNa 5pGH4M+31nh5xZz/wfUDjqz+F+chpRfIQxRcOfjOZCHv3Kr5I/JW5ij28Xkbr4qWtRM5 YkRADMDDyj2VqCKLq/T+6m5nOSLSTdVENpZensMGfWETPa2F5BTEquw/Ct2gbbK6Nvcu yBlFImG2ZDqJX9nv8JzVcGHVuaYjrXNPgF0t/DEQ0sdpve1jcVjRvdD0ixu5rPOuuV/1 CtSA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q12si1160822edn.458.2020.11.25.04.52.44; Wed, 25 Nov 2020 04:53:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729194AbgKYMtJ (ORCPT + 99 others); Wed, 25 Nov 2020 07:49:09 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:8584 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726009AbgKYMtI (ORCPT ); Wed, 25 Nov 2020 07:49:08 -0500 Received: from DGGEMS407-HUB.china.huawei.com (unknown [172.30.72.59]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4Ch10Q354gzLvGy; Wed, 25 Nov 2020 20:48:38 +0800 (CST) Received: from huawei.com (10.175.124.27) by DGGEMS407-HUB.china.huawei.com (10.3.19.207) with Microsoft SMTP Server id 14.3.487.0; Wed, 25 Nov 2020 20:48:57 +0800 From: Wang ShaoBo To: CC: , , , , , Subject: [PATCH] cpufreq: Fix error return code in cpufreq_online() Date: Wed, 25 Nov 2020 20:48:53 +0800 Message-ID: <20201125124853.30470-1-bobo.shaobowang@huawei.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.124.27] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Fix to return proper error code instaed of 0 in cpufreq_online(), as done elsewhere in this function. Signed-off-by: Wang ShaoBo --- drivers/cpufreq/cpufreq.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 1e7e3f2ff09f..4645c2b78682 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -1391,8 +1391,10 @@ static int cpufreq_online(unsigned int cpu) policy->min_freq_req = kzalloc(2 * sizeof(*policy->min_freq_req), GFP_KERNEL); - if (!policy->min_freq_req) + if (!policy->min_freq_req) { + ret = -ENOMEM; goto out_destroy_policy; + } ret = freq_qos_add_request(&policy->constraints, policy->min_freq_req, FREQ_QOS_MIN, @@ -1429,6 +1431,7 @@ static int cpufreq_online(unsigned int cpu) if (cpufreq_driver->get && has_target()) { policy->cur = cpufreq_driver->get(policy->cpu); if (!policy->cur) { + ret = -EINVAL; pr_err("%s: ->get() failed\n", __func__); goto out_destroy_policy; } -- 2.17.1