Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit 72cacd0

Browse files
jpanisbldlezcano
authored andcommitted
thermal/drivers/mediatek/lvts_thermal: Return error in case of invalid efuse data
This patch prevents from registering thermal entries and letting the driver misbehave if efuse data is invalid. A device is not properly calibrated if the golden temperature is zero. Fixes: f5f633b ("thermal/drivers/mediatek: Add the Low Voltage Thermal Sensor driver") Signed-off-by: Julien Panis <jpanis@baylibre.com> Reviewed-by: Nicolas Pitre <npitre@baylibre.com> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Link: https://lore.kernel.org/r/20240604-mtk-thermal-calib-check-v2-1-8f258254051d@baylibre.com Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
1 parent d9fef76 commit 72cacd0

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

drivers/thermal/mediatek/lvts_thermal.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -769,7 +769,11 @@ static int lvts_golden_temp_init(struct device *dev, u8 *calib,
769769
*/
770770
gt = (((u32 *)calib)[0] >> lvts_data->gt_calib_bit_offset) & 0xff;
771771

772-
if (gt && gt < LVTS_GOLDEN_TEMP_MAX)
772+
/* A zero value for gt means that device has invalid efuse data */
773+
if (!gt)
774+
return -ENODATA;
775+
776+
if (gt < LVTS_GOLDEN_TEMP_MAX)
773777
golden_temp = gt;
774778

775779
golden_temp_offset = golden_temp * 500 + lvts_data->temp_offset;

0 commit comments

Comments
 (0)