summaryrefslogtreecommitdiffstats
path: root/drivers/hwmon
diff options
context:
space:
mode:
authorAhmad Khalifa <ahmad@khalifa.ws>2022-10-04 23:01:03 +0200
committerGuenter Roeck <linux@roeck-us.net>2022-12-05 01:45:02 +0100
commitb3b19931a5c22f5a09f846e037b23f8a74455d0a (patch)
tree8b537a2ce59175a3709289a6a8000deb1588c0b2 /drivers/hwmon
parenthwmon: (it87) Add param to ignore ACPI resource conflicts (diff)
downloadlinux-b3b19931a5c22f5a09f846e037b23f8a74455d0a.tar.xz
linux-b3b19931a5c22f5a09f846e037b23f8a74455d0a.zip
hwmon: (it87) Check for a valid chip before using force_id
Check there is a chip before using force_id parameter as there is no value in registering a non-existent chip Signed-off-by: Ahmad Khalifa <ahmad@khalifa.ws> Link: https://lore.kernel.org/r/20221004210100.540120-3-ahmad@khalifa.ws Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r--drivers/hwmon/it87.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c
index e920dd26225f..73ed21ab325b 100644
--- a/drivers/hwmon/it87.c
+++ b/drivers/hwmon/it87.c
@@ -2401,7 +2401,13 @@ static int __init it87_find(int sioaddr, unsigned short *address,
return err;
err = -ENODEV;
- chip_type = force_id ? force_id : superio_inw(sioaddr, DEVID);
+ chip_type = superio_inw(sioaddr, DEVID);
+ /* check first for a valid chip before forcing chip id */
+ if (chip_type == 0xffff)
+ goto exit;
+
+ if (force_id)
+ chip_type = force_id;
switch (chip_type) {
case IT8705F_DEVID: