Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp405049pxu; Thu, 26 Nov 2020 01:29:07 -0800 (PST) X-Google-Smtp-Source: ABdhPJwsk8YUWjnav8YmQWEyhTgM2tVeScPfeWlI7xDL1+0d8rQsiJ2gKURZp4xT/SARFYDI91lQ X-Received: by 2002:aa7:c61a:: with SMTP id h26mr1683861edq.327.1606382947735; Thu, 26 Nov 2020 01:29:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606382947; cv=none; d=google.com; s=arc-20160816; b=vuER14ntM+Nba6Nqdg+XjcXDIrim9QwfHZPOU58Ic/ol7zPzt72rAXWImDm5VuQua1 C5t7UOqIhNMIQ2oRK0lu7cnpy4VrZgKAI/AudzoWa8ul7TOXOUcHO14vDH4K6F9HOdf2 BjOdbdKmi06PZRW/210EZhsc0Aftn2jnFO0vnhve5f0sgasUeb9HnbRfiwK8AflklyK8 Y/CXZyM68YPjSksWpdN+r3Hn/9z3wXoQe5v0qWuoxNqXu9DRSHB+553RjQuz5xECoKdS m11zXgp4eLuWWbpEDC+tISStkM8s6bM7kV+6NjNWpG6tdu6Emc7lNhpK5WiRiCX4xpjW NCmw== 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=tylHcECZaMlZuFs+SwrGsqec1WNCYtlN9zNhQSVRd/Q=; b=EZCzrgi+1ybTR9sNuBH6la5X+yD9/YEcDI0sz8Rifg1qJTWzX8zwmVYW1ORLIhlZbs wPRGdCcVWTsRbUkxF0M0Bs6fw7YL00kTQ77o4xKMzj/VO3ylDgowqt/ZDULbPr5zRX1I 5lAbJyKQWfLYbRI+5ROO4inQ82T7zc2lPEu9ysIaHdfybpw4eSamvVdzG6XahZDvX79r H/v+g7cJaWafmZm4x83e3XWI86Fs6/HfUr3cLXSU/jICMu5L5b/9XZFzbwBzCaEyV/G0 kW6v6T+4xpfp7zQYm5ZxzeWEMtW0suAfMuqKgsEO6kYiGjJAe959YYcpZCQkprpf+AYA uuJw== 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 a12si3043252edf.2.2020.11.26.01.28.08; Thu, 26 Nov 2020 01:29:07 -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 S1729908AbgKZBM5 (ORCPT + 99 others); Wed, 25 Nov 2020 20:12:57 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:8587 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726009AbgKZBM5 (ORCPT ); Wed, 25 Nov 2020 20:12:57 -0500 Received: from DGGEMS412-HUB.china.huawei.com (unknown [172.30.72.59]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4ChKVg01mhzLtxk; Thu, 26 Nov 2020 09:12:27 +0800 (CST) Received: from huawei.com (10.175.124.27) by DGGEMS412-HUB.china.huawei.com (10.3.19.212) with Microsoft SMTP Server id 14.3.487.0; Thu, 26 Nov 2020 09:12:46 +0800 From: Wang ShaoBo To: CC: , , , , , Subject: [PATCH v2] cpufreq: Fix error return code in cpufreq_online() Date: Thu, 26 Nov 2020 09:12:39 +0800 Message-ID: <20201126011239.42294-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 instead 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..d3a28de35593 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 = -EIO; pr_err("%s: ->get() failed\n", __func__); goto out_destroy_policy; } -- 2.17.1