mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-25 18:30:06 +00:00
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>
This commit is contained in:
parent
12c44ab8b4
commit
b3b19931a5
1 changed files with 7 additions and 1 deletions
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue