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 E57D22EF652; Sat, 30 May 2026 18:34:48 +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=1780166089; cv=none; b=Fe5F87mQH2fuReuV3DXb9JeleZMD1hcgsW7ukXZtUrZ9maIx+p+zvqYUzvNM5XEYrKd2W80MQcvrKU28wTz2bu+K9eHS0cp5RWuBrfqMUbbQt6TpTr3qCA5Wo71BiiT2byA7fU2i8FstV7aY+EAmE1DhvEFuAJjaKLKl3POCCmA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780166089; c=relaxed/simple; bh=qXMpd+eW3EvSvR17Bud6OBoEZqvxMaQ/dlBL6EhgjN4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=EmMWS24AA1Ny9gN4OaLAWvUEIU6SBfHtGBV7XatQ6ZXt8jsS5mFfDZ7Cg1C+S8Hcq4sH60jCIzpVVmKPDqrud30qSncZkOAIAA1hGPWao3HsMejMpvdCFbGt4MnECeyOrhcIYnmd0pXUThJ2bV9X+xDoNy+G3eZNfZ13zDHWnfk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=pkKPqlNS; 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="pkKPqlNS" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3702C1F00893; Sat, 30 May 2026 18:34:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1780166088; bh=1rL3zh3KGIFydj1Uu06MrPTqGyMPOoaE9o86aCllI8Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=pkKPqlNSb8PKB7DYWFusRYgZqqYiDdAYUZywV6MUQ3LyQtM5Lq87ZUwGCfgSywvk8 /NYRJSPE4WGSsClG87Vq4QBKUVsxn1Rv5VvIm158Zt4SvLxmzYMRQ5oEHyh9zgnGdi 54T8JdO4EnGXJQzbUClhm79QlwdEwI+mIhVJek/0= 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 5.10 243/589] thermal/drivers/sprd: Fix raw temperature clamping in sprd_thm_rawdata_to_temp Date: Sat, 30 May 2026 18:02:04 +0200 Message-ID: <20260530160231.386332617@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260530160224.570625122@linuxfoundation.org> References: <20260530160224.570625122@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 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Thorsten Blum commit b3414148bbc1f9cd56217e58a558c6ac4fd1b4a6 upstream. The raw temperature data was never clamped to SPRD_THM_RAW_DATA_LOW or SPRD_THM_RAW_DATA_HIGH because the return value of clamp() was not used. Fix this by assigning the clamped value to 'rawdata'. Casting SPRD_THM_RAW_DATA_LOW and SPRD_THM_RAW_DATA_HIGH to u32 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-2-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 @@ -178,7 +178,7 @@ static int sprd_thm_sensor_calibration(s static int sprd_thm_rawdata_to_temp(struct sprd_thermal_sensor *sen, u32 rawdata) { - clamp(rawdata, (u32)SPRD_THM_RAW_DATA_LOW, (u32)SPRD_THM_RAW_DATA_HIGH); + rawdata = clamp(rawdata, SPRD_THM_RAW_DATA_LOW, SPRD_THM_RAW_DATA_HIGH); /* * According to the thermal datasheet, the formula of converting