Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp386205pxu; Wed, 25 Nov 2020 05:51:37 -0800 (PST) X-Google-Smtp-Source: ABdhPJz2WsZSOb7lqvG/Wo3jGVVT8tmRjv1i9nw0E3Nhu2H9tfOnr/S/IfrB+4zeGoACD1J9cn+s X-Received: by 2002:a17:907:20ac:: with SMTP id pw12mr3079848ejb.245.1606312296910; Wed, 25 Nov 2020 05:51:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606312296; cv=none; d=google.com; s=arc-20160816; b=MbrlbiI7oWt9PF67CNJIaSnTud2pdyNA2SIwzyrUROV/1Pl9Kc/yxaneEfHad/w0FT 1h8kS8KuIFEJNR5EV95vas5MoYa1vepFmvSHTitVZ7dLbDyGgbdTUP5KhtgMj5KUo9ep iE1pvAFfRS6AKR4cG296mRTP/vrjAl+QlyRECp8SW+dSYeUF88hkshdiN6CI3AJb560S 2F04fHBFmm4Kz7h48du+ipXO3PXfUMhyvH8tZBwsgyK2uPGzIJafy/iDOPQqGxqolg6M BetcuvPqFIUbDsO5FPFbwwuy/DpH4zgGu9SxRb7ICqdOrMZaApLPPhQL7detYNcVVAfj S7UA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=IoB39l7/Alku48XvRUqPTRybG7CsyQ69DBTAGxbwHjw=; b=v1ZAwMJ6gt7FZtK0cd+TuK3qKoGYXL9t53dWzm0ARlrz7rgP5Rrug2y9qABywEKmTK FZC22A2eX0Svhs4vwUFvT6rqissRMg4S6xQEkOedi2SJje6MeKZtpHl6qRhxgMj/eYmL 2RWss9p48sG4i7hN0CJnvl5vCxiCtIfzXCx+xttKhgVpjkL5s03E6c7xWXvUpDxDqnWh jICpQulKvSCgc3neftdVfRJC1+I/pLtBuofaDa+EXIuAIUFMbUJm7sm7aKJztx9N/UB1 SWRKdcRkKOUYBDo/72zSPb2jnZEv4PxYdDveMNEwf5pZdAL9+YILLI3hX7jD0+3hTIDE egqQ== 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g17si1336149edp.303.2020.11.25.05.51.13; Wed, 25 Nov 2020 05:51:36 -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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729551AbgKYNtk (ORCPT + 99 others); Wed, 25 Nov 2020 08:49:40 -0500 Received: from mail-ot1-f67.google.com ([209.85.210.67]:42861 "EHLO mail-ot1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727626AbgKYNtk (ORCPT ); Wed, 25 Nov 2020 08:49:40 -0500 Received: by mail-ot1-f67.google.com with SMTP id 11so2239571oty.9; Wed, 25 Nov 2020 05:49:26 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=IoB39l7/Alku48XvRUqPTRybG7CsyQ69DBTAGxbwHjw=; b=SP+O3utneY1PIysIp+cjXgAfYj2bjY4kVXUNzE18nD5NC7yTDU8IbIiTWc2kPI7tK5 VhoDyqAx+MTjwjlXvGz4Mp7epQ0WU1ToBsddhgQklJRu9/7L90AzhVvAfthhzrFIthQL yNUvF3LuM7zZP+gpqTNVlju49H4MHwNeWX3T+mWdZh8CVmxGvPesSPSBaunmAldNa7oV pnrhYIwh9ey2VxudNplP1KgGZIN7Llo0Euj0mZkVL+kguqYU/616RrHh+AE5zc50LW5d SKdUlKZxJ1trt0CBinPDQ09qOS8/cKFWKm4c68EGbwxETD8NjEZi9v2L2hCXM9IGejvJ iGBQ== X-Gm-Message-State: AOAM532eRJXPiIBuM84HQq97dQtW96HQnUsoePmoeSLy8fEpiPa+zTA8 vJDhILLI8y/9FJ/FChzgO77FMmxZb8mpYbXDI3k= X-Received: by 2002:a9d:171a:: with SMTP id i26mr2881261ota.260.1606312166377; Wed, 25 Nov 2020 05:49:26 -0800 (PST) MIME-Version: 1.0 References: <20201125124853.30470-1-bobo.shaobowang@huawei.com> In-Reply-To: <20201125124853.30470-1-bobo.shaobowang@huawei.com> From: "Rafael J. Wysocki" Date: Wed, 25 Nov 2020 14:49:13 +0100 Message-ID: Subject: Re: [PATCH] cpufreq: Fix error return code in cpufreq_online() To: Wang ShaoBo Cc: "Rafael J. Wysocki" , Viresh Kumar , Linux PM , Linux Kernel Mailing List , huawei.libin@huawei.com, cj.chengjian@huawei.com Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Nov 25, 2020 at 1:49 PM Wang ShaoBo wrote: > > Fix to return proper error code instaed of 0 in cpufreq_online(), as done s/instaed/instead/ > 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; This error code isn't suitable to be returned from here. -EIO would be better. > pr_err("%s: ->get() failed\n", __func__); > goto out_destroy_policy; > } > --