From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-177.mta0.migadu.com (out-177.mta0.migadu.com [91.218.175.177]) (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 3A37D2F25E4 for ; Sat, 7 Mar 2026 10:24:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.177 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772879084; cv=none; b=gTdsj5uXqgsordNYWw1KsErt5b5d3ksztInnzzcj/63Rll0WyxbiQT8whaPVsaYS18aGOHczogXCuOrL3D5/Fhgs9N9AFuSqWh6tQpx9kgI6TJ/ibZdxwHkg2x+ChunX+CGltuGEKK5Dulh4brS2+hP7wMJiMf8sTqiutrbvH8Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772879084; c=relaxed/simple; bh=utRV2+6I3LgLduDu/KJXDgOGejeY0SEDZR5byLzsKp0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Vq7/Db94b2/dvZeqKFmiFKsd5tmWyONu3FYqWOGaXucbjp0t4vEdtBSxMNREyvqrjyN9yD1SdybQWQyoVStJpQtooNJFJ3N1k5IOlJg6NyKLOIEOxZxyP9y/eXyzD/qUV/Tgr8WmRAkzzxTxkTMFJMMvmITjyYcn/pyvGEoQZao= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=LqaSpoCj; arc=none smtp.client-ip=91.218.175.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="LqaSpoCj" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1772879080; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6USrcSxUYKm6Dm6G6yk0PRsoOGZoklo1MPA1uNlpK+g=; b=LqaSpoCj7/KpcVmELXnVxPzG4KLOCydtk/5ipg11dq58sSF1e0ZGIL4jVJmG+EeBgAbq9o ntncLS3tbS/jBkN1mGKjGBUSJS0XlAQSNCLrLMiD2OUyuJd0fEjtapHBLE20gjS7V2ut6D 0qodMdTqrr1n7lvsHMM/ZuvskRRKZmw= From: Thorsten Blum To: "Rafael J. Wysocki" , Daniel Lezcano , Zhang Rui , Lukasz Luba , Orson Zhai , Baolin Wang , Chunyan Zhang , Freeman Liu Cc: Thorsten Blum , stable@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH RESEND 2/2] thermal: sprd: Fix raw temperature clamping in sprd_thm_rawdata_to_temp Date: Sat, 7 Mar 2026 11:24:21 +0100 Message-ID: <20260307102422.306055-2-thorsten.blum@linux.dev> In-Reply-To: <20260307102422.306055-1-thorsten.blum@linux.dev> References: <20260307102422.306055-1-thorsten.blum@linux.dev> Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT 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") Cc: stable@vger.kernel.org Reviewed-by: Baolin Wang Signed-off-by: Thorsten Blum --- drivers/thermal/sprd_thermal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/thermal/sprd_thermal.c b/drivers/thermal/sprd_thermal.c index 70c879e75d85..44fa45f74da7 100644 --- a/drivers/thermal/sprd_thermal.c +++ b/drivers/thermal/sprd_thermal.c @@ -178,7 +178,7 @@ static int sprd_thm_sensor_calibration(struct device_node *np, 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 -- Thorsten Blum GPG: 1D60 735E 8AEF 3BE4 73B6 9D84 7336 78FD 8DFE EAD4