• Cosmo Chou's avatar
    hwmon: (pt5161l) Fix invalid temperature reading · 7bbc0795
    Cosmo Chou authored
    The temperature reading function was using a signed long for the ADC
    code, which could lead to mishandling of invalid codes on 32-bit
    platforms. This allowed out-of-range ADC codes to be incorrectly
    interpreted as valid values and used in temperature calculations.
    
    Change adc_code to u32 to ensure that invalid ADC codes are correctly
    identified on all platforms.
    
    Fixes: 1b2ca93c ("hwmon: Add driver for Astera Labs PT5161L retimer")
    Signed-off-by: default avatarCosmo Chou <chou.cosmo@gmail.com>
    Message-ID: <20240819104630.2375441-1-chou.cosmo@gmail.com>
    Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
    7bbc0795
pt5161l.c 15.2 KB