Commit b3b19931 authored by Ahmad Khalifa's avatar Ahmad Khalifa Committed by Guenter Roeck

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: default avatarAhmad Khalifa <ahmad@khalifa.ws>
Link: https://lore.kernel.org/r/20221004210100.540120-3-ahmad@khalifa.wsSigned-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
parent 12c44ab8
...@@ -2401,7 +2401,13 @@ static int __init it87_find(int sioaddr, unsigned short *address, ...@@ -2401,7 +2401,13 @@ static int __init it87_find(int sioaddr, unsigned short *address,
return err; return err;
err = -ENODEV; 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) { switch (chip_type) {
case IT8705F_DEVID: case IT8705F_DEVID:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment