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 752CC26F288; Sat, 30 May 2026 17:01:04 +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=1780160465; cv=none; b=mlrmKif9DukewHb/i+s5XS1gqaj9hno5yGiGhWmwS4i84p5A73i2FjUUN+5fihboJwCnuYq7mkBAaymwS8n5TexDvIrFJqD0kYqWbsgmfXrmoofA3Ur7Z4K6b8LbVmrbx6rn75B6zLRzai0gdzgAGad7Wk3oFvbR5RR1U7ydObI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780160465; c=relaxed/simple; bh=P3aAYRLLrOQQUNLGvvCxonqVOc7IwlckehMwCCAsUVk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=KBIt6pCKBsh6uBdvhglfe2piB8u6k3bjBIlmpiG73cESJJMM2JCvcotHb/ClzslItc5RH2pOD2afS4E7Uv9tyKVWPUXhB3Et0B+q6lFSjdB8XHHe1Z658X16Bx8Opf+gzHoipVUF8xl6rRmGHwAjpASkkMb7oFB7hchm6cwp6XU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=C2rxnMD2; 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="C2rxnMD2" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8E6CD1F00893; Sat, 30 May 2026 17:01:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1780160464; bh=eMPMaFv7Ne6xV9Al3lfDTZFQBSaieyALpy2IT26vQjA=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=C2rxnMD2VCHSJ8MpwXZ8tIRP+ec9Dmbdkcbtz5lZq/vgyb1EEA+cM5FI1LJIcWHI+ GItYFOfPh1MBsz5UfAXzt3VGqj8dtE9OiQfpVOVSzrft6kVwv17mDFXGIl8bsH1hfi usmWDO4EZBjWErqIxoOcw1xsZ0IdF64rX8Wvxl1s= 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 338/969] thermal/drivers/sprd: Fix raw temperature clamping in sprd_thm_rawdata_to_temp Date: Sat, 30 May 2026 17:57:42 +0200 Message-ID: <20260530160309.702171139@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 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