From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4E2A4C761A6 for ; Tue, 4 Apr 2023 03:08:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232743AbjDDDIt (ORCPT ); Mon, 3 Apr 2023 23:08:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57256 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232833AbjDDDIq (ORCPT ); Mon, 3 Apr 2023 23:08:46 -0400 Received: from out-4.mta1.migadu.com (out-4.mta1.migadu.com [IPv6:2001:41d0:203:375::4]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8562A170A for ; Mon, 3 Apr 2023 20:08:41 -0700 (PDT) MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1680577717; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=h2jWPezVO29/X7/c6BGQ5cVlKWQV5b6jUODU7F71l8g=; b=a8IcIEN7PmetPwAyDfihSGSTRo8CZoaaswAyktN+U/ZI87qi43VEdkEjA+wWSEGyLG9Cgc nZsQ5LbapVAiscw+UDxP/5dccH/+j3jBFAzFwtD8Th+/n+P9TSLdcpkVa48qCV3H7RhQyh Q6gKgeS/YD4HPHxFGp69ADhcSFyjUaw= Date: Tue, 04 Apr 2023 03:08:30 +0000 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: "Yajun Deng" Message-ID: Subject: Re: [PATCH] cpufreq: Fix policy->freq_table is NULL in __cpufreq_driver_target() To: "Viresh Kumar" Cc: rafael@kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20230403041128.jrsvbm4ddxdyhddg@vireshk-i7> References: <20230403041128.jrsvbm4ddxdyhddg@vireshk-i7> <20230329133600.908723-1-yajun.deng@linux.dev> X-Migadu-Flow: FLOW_OUT Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org April 3, 2023 12:11 PM, "Viresh Kumar" wrote:= =0A=0A> On 29-03-23, 21:36, Yajun Deng wrote:=0A> =0A>> __resolve_freq() = may be return target_freq if policy->freq_table is=0A>> NULL. In this cas= e, it should return -EINVAL before __target_index().=0A>> =0A>> Signed-of= f-by: Yajun Deng =0A>> ---=0A>> drivers/cpufreq/cpu= freq.c | 2 +-=0A>> 1 file changed, 1 insertion(+), 1 deletion(-)=0A>> =0A= >> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c=0A>= > index c0e5be0fe2d6..308a3df1a940 100644=0A>> --- a/drivers/cpufreq/cpuf= req.c=0A>> +++ b/drivers/cpufreq/cpufreq.c=0A>> @@ -2299,7 +2299,7 @@ int= __cpufreq_driver_target(struct cpufreq_policy *policy,=0A>> return cpufr= eq_driver->target(policy, target_freq, relation);=0A>> }=0A>> =0A>> - if = (!cpufreq_driver->target_index)=0A>> + if (!cpufreq_driver->target_index = || !policy->freq_table)=0A>> return -EINVAL;=0A> =0A> Hi,=0A> =0A> I have= sent an alternate patch [1] for this, please try it.=0A>=0A =0AThanks, v= 2 is fine.=0A=0A> --=0A> viresh=0A> =0A> [1]=0A> https://lore.kernel.org/= all/53d4ed4e5b18a59a48790434f8146fb207e11c49.1680494945.git.viresh.kumar@= lin=0A> ro.org