Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

hwmon: (nct6775) Do not accept force_id unless chip is found

Since commit 698a7c24a544 ("hwmon: (nct6775) Support two SuperIO chips
in the same system"), the driver supports two Super-IO chips. This has
the undesirable side effect that force_id always detects a second chip
at address 0xfff8, even if no chip exists at that address.

nct6775: Found NCT6793D or compatible chip at 0x4e:0xfff8

If no chip at all is found at a given SIO address, it does not make sense
to instantiate it. Limit force_id to only work if some chip is found,
that is if the chip ID returns a value other than 0xffff.

Reviewed-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>

+4 -4
+4 -4
drivers/hwmon/nct6775.c
··· 4232 4232 if (err) 4233 4233 return err; 4234 4234 4235 - if (force_id) 4235 + val = (superio_inb(sioaddr, SIO_REG_DEVID) << 8) | 4236 + superio_inb(sioaddr, SIO_REG_DEVID + 1); 4237 + if (force_id && val != 0xffff) 4236 4238 val = force_id; 4237 - else 4238 - val = (superio_inb(sioaddr, SIO_REG_DEVID) << 8) 4239 - | superio_inb(sioaddr, SIO_REG_DEVID + 1); 4239 + 4240 4240 switch (val & SIO_ID_MASK) { 4241 4241 case SIO_NCT6106_ID: 4242 4242 sio_data->kind = nct6106;