Skip to content

Commit b341414

Browse files
tobluxDaniel Lezcano
authored andcommitted
thermal/drivers/sprd: Fix raw temperature clamping in sprd_thm_rawdata_to_temp
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: 554fdba ("thermal: sprd: Add Spreadtrum thermal driver support") Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev> Signed-off-by: Daniel Lezcano <daniel.lezcano@kernel.org> Reviewed-by: Baolin Wang <baolin.wang@linux.alibaba.com> Cc: stable@vger.kernel.org Link: https://patch.msgid.link/20260307102422.306055-2-thorsten.blum@linux.dev
1 parent 83c0f9a commit b341414

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/thermal/sprd_thermal.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ static int sprd_thm_sensor_calibration(struct device_node *np,
178178
static int sprd_thm_rawdata_to_temp(struct sprd_thermal_sensor *sen,
179179
u32 rawdata)
180180
{
181-
clamp(rawdata, (u32)SPRD_THM_RAW_DATA_LOW, (u32)SPRD_THM_RAW_DATA_HIGH);
181+
rawdata = clamp(rawdata, SPRD_THM_RAW_DATA_LOW, SPRD_THM_RAW_DATA_HIGH);
182182

183183
/*
184184
* According to the thermal datasheet, the formula of converting

0 commit comments

Comments
 (0)