Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2562767lqp; Mon, 25 Mar 2024 02:41:50 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUpjWWEzjPVr3MQBshOIx+NFAlAff1h1JdLuimM9RMX20GNRuYc8FsqPtsYolp+MEh9k54qP4jChVnvxiCCK5Y1zcz9dnuIOw1XjNNaKA== X-Google-Smtp-Source: AGHT+IEidzW96xRpTUzcKVlsWKE7uDd4+sV1kgat0C/qol5d0FEO9iO3rgOa8nOIqzPne4OmHyPW X-Received: by 2002:a17:906:da89:b0:a47:52d7:60d4 with SMTP id xh9-20020a170906da8900b00a4752d760d4mr2705379ejb.57.1711359710276; Mon, 25 Mar 2024 02:41:50 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711359710; cv=pass; d=google.com; s=arc-20160816; b=UepculBHWERvH2szr6P92887Aor17m25ZyEw8FwgPR9ff0FdIKRCVP5BDYl8HmaC6V rty9Cbig7tQxDbBwa9SxGziuGtrIDh6rGsO96/jdqhc1ZsZ7ybsMREVrI1umF8KRhh44 tcTtBH0/B99cJb9OdlTObdCKvRLuX5AvbKs4SstHSAWVTpiG0t2wXPrV4Yrezi8Aw2E0 6aH8jyiEZkDuHTkIOIp9uTaltr866mf1uHiF2KyJoDELqmKwDgYxFP7jPQqvK/fzBVih g3smTnswyvb3kx5/JLD358POTctIBBFAtZgdut5a6zeSjcGjexTPpXnWTlo3cc/9lsF7 Olhw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=Tkan0aOlz4hHw420yIXG/7TN7E//iJnC84mMec4v5LA=; fh=xBeq4AytFH82+QG5rsBK2pd0Oxlh95Ju/nJEmuqnwfQ=; b=rsmjd7BMBpZNqBDteWTkTvKqeZNK5y9QZMUMLSlux2ARU3Q4BmL1ResgTcjK2tq1/O /QFFCilg4wLv+FqGFRUhMI4oD2/3xuAPIy8WHTVEd/OGZzD01gElaqvrC6IDfjef9ZbC zKrlFpw36NcsuRdSDYXNjSHmaaqzs/3iZdHuyYQ/MBsi+jjQvj95xbGpBd7vi6LFQ+/d dcULpeCx9qz6dbMCyLWejGPDaOSX3on4AajWNGuboE0nqa/Xz9ZyumVQFL34HFAUdK+b sRlgsfDu0mk7ZcdQ6vVxoNNfHW2Zo2zN1coZP3sgVLg1FjofdJdSaPKAyvmGfob8jZdU sJcw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=I4Wi4FKW; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-115894-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-115894-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id g4-20020a170906538400b00a47103b1f7esi2390300ejo.212.2024.03.25.02.41.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 02:41:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-115894-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=I4Wi4FKW; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-115894-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-115894-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id D83AB1F37C38 for ; Mon, 25 Mar 2024 09:41:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 46C6A386631; Mon, 25 Mar 2024 03:03:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="I4Wi4FKW" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C406D14601B; Sun, 24 Mar 2024 23:14:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711322086; cv=none; b=pAQKtvzfPMo9bnTRJHVNJ0H+gsRlpr0MOmumZYuMPEZZ6VrnTT0kUZQ9WiI62HbCG8ZeIOUpmx9XvpFCDcj5KDqTG/Mc2PnIaMkr4EdRH8N3502e81AFe8ji0AkLtK/MLqe3b9jdNPtBo5zsnqgciUj75jy5N4O4oolW/3DTT08= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711322086; c=relaxed/simple; bh=OC6s1nGnzvG27cdhEV9v+152Ge649GD6EUnGf7Ba9Jc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=WbGaEQEIvrWZKXSXk0Oa1th6GnhmhYXHKA/sMlTbWTNbhPrudjuKi//TlKPIJv+eLfC0VOq5gnJ5cdlPtmCKozXu16fBvfXqNUS4hCygcnQIxMLxFz7ZjGajq0euUr+7bwoUU5rNklPGcaesUVapqZpUGpEsK9zWOrRg099wEFg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=I4Wi4FKW; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0DA98C433A6; Sun, 24 Mar 2024 23:14:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711322086; bh=OC6s1nGnzvG27cdhEV9v+152Ge649GD6EUnGf7Ba9Jc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=I4Wi4FKWMUm3GKg4EP2rytxxnr4bEGd2cYu1Wfl/sxmsjKm/fWpnKNeLcweJiZdN8 sYb739cYjvIqQeI6y/sSMtQugbe6CM6/jhguDBCV5jlk85JVqv/mtVD6r561Yec8q0 rGu+fZwcPfxi2J2B3OBBixI1+5+uzi06Sq1J1/rsvkhU+x4e8H7UehE1JDuPDCPj/1 XgWZE7L093VPRgSnwMcAE87uNuz8bJoi2/FaitG+kcJuz3wRX5JumUlavZ2nBsHF7w LpZse7Dm/L7NbwvgrYgqgQv1K5gUdNDG/bzitJHn2v877L+yGfeoHmhgm4ZArRuE2r f78hRWfkY9ZAA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Daniel Lezcano , "Rafael J . Wysocki" , Sasha Levin Subject: [PATCH 6.1 160/451] powercap: dtpm_cpu: Fix error check against freq_qos_add_request() Date: Sun, 24 Mar 2024 19:07:16 -0400 Message-ID: <20240324231207.1351418-161-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324231207.1351418-1-sashal@kernel.org> References: <20240324231207.1351418-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit From: Daniel Lezcano [ Upstream commit b50155cb0d609437236c88201206267835c6f965 ] The caller of the function freq_qos_add_request() checks again a non zero value but freq_qos_add_request() can return '1' if the request already exists. Therefore, the setup function fails while the QoS request actually did not failed. Fix that by changing the check against a negative value like all the other callers of the function. Fixes: 0e8f68d7f0485 ("Add CPU energy model based support") Signed-off-by: Daniel Lezcano Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin --- drivers/powercap/dtpm_cpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/powercap/dtpm_cpu.c b/drivers/powercap/dtpm_cpu.c index 9193c3b8edebe..ae7ee611978ba 100644 --- a/drivers/powercap/dtpm_cpu.c +++ b/drivers/powercap/dtpm_cpu.c @@ -219,7 +219,7 @@ static int __dtpm_cpu_setup(int cpu, struct dtpm *parent) ret = freq_qos_add_request(&policy->constraints, &dtpm_cpu->qos_req, FREQ_QOS_MAX, pd->table[pd->nr_perf_states - 1].frequency); - if (ret) + if (ret < 0) goto out_dtpm_unregister; cpufreq_cpu_put(policy); -- 2.43.0