From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 D4FC826F288; Sat, 30 May 2026 17:03:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780160581; cv=none; b=nvDqRHSQAD2w7zJNTCd7L+Pku+Ads48QjpYRPRJETRiMUrDDinl8EaaOOTNFvvYU8VFuZ7tsDxKyiQCc0F7HlxO75+IlhA5378L57/nKzStPjVEEaEUEZTunPZikYwW4iA9I6nXwYbh4IPcDX4i/HSJyWYD75NJRAJySsVphNro= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780160581; c=relaxed/simple; bh=oeEsOr9o4+zAR7XCC21hgwgekYa29p8KNGVMlKni9is=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZvZqiw8oIt93pw37sXrCWpazMDXtSAH0C6hUGhkIsgVf6kY7ws7z/qS2upxRwlOnUq1DENDYYbbwIqn9hHZCAW33AQkaJMMwFRAeS61Wh1KagImTzIFAOY8yejg0o29bWDDT62I5vQne4xZKaMkWacB5vbwnsmwvsH8bi2X/vWU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=deSVCEQX; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="deSVCEQX" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 220461F00893; Sat, 30 May 2026 17:02:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1780160580; bh=Owa6/D78hpStHWhQTRuX13GLeBJ7j/szfxc6+k+VQ98=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=deSVCEQXApfvSh3rkbreUOYep6JUx2uwaVmq0gG2Hhp/1YZd0EdkWEDtyzgdpXlg7 RL8gyGntbunPhEli0bKYOBH6Wl/fUpDwhxlygIpCeEQkiq1YmsqexuHAPFO5du3O28 mULqvf+6rH4burGOVykR/ryeeuBhzwGaz8tdLSKw= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Thorsten Blum , Daniel Lezcano , Baolin Wang Subject: [PATCH 6.1 337/969] thermal/drivers/sprd: Fix temperature clamping in sprd_thm_temp_to_rawdata Date: Sat, 30 May 2026 17:57:41 +0200 Message-ID: <20260530160309.674330097@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260530160300.485627683@linuxfoundation.org> References: <20260530160300.485627683@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Thorsten Blum commit 83c0f9a5d679a6f8d84fc49b2f62ea434ccab4b6 upstream. The temperature was never clamped to SPRD_THM_TEMP_LOW or SPRD_THM_TEMP_HIGH because the return value of clamp() was not used. Fix this by assigning the clamped value to 'temp'. Casting SPRD_THM_TEMP_LOW and SPRD_THM_TEMP_HIGH to int is also redundant and can be removed. Fixes: 554fdbaf19b1 ("thermal: sprd: Add Spreadtrum thermal driver support") Signed-off-by: Thorsten Blum Signed-off-by: Daniel Lezcano Reviewed-by: Baolin Wang Cc: stable@vger.kernel.org Link: https://patch.msgid.link/20260307102422.306055-1-thorsten.blum@linux.dev Signed-off-by: Greg Kroah-Hartman --- drivers/thermal/sprd_thermal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/thermal/sprd_thermal.c +++ b/drivers/thermal/sprd_thermal.c @@ -192,7 +192,7 @@ static int sprd_thm_temp_to_rawdata(int { u32 val; - clamp(temp, (int)SPRD_THM_TEMP_LOW, (int)SPRD_THM_TEMP_HIGH); + temp = clamp(temp, SPRD_THM_TEMP_LOW, SPRD_THM_TEMP_HIGH); /* * According to the thermal datasheet, the formula of converting