Commit 8dee04de authored by Guenter Roeck's avatar Guenter Roeck Committed by Greg Kroah-Hartman

hwmon: (it87) Avoid registering the same chip on both SIO addresses

commit 8358378b upstream.

IT8705F is known to respond on both SIO addresses. Registering it twice
may result in system lockups.
Reported-by: default avatarRussell King <linux@armlinux.org.uk>
Fixes: e84bd953 ("hwmon: (it87) Add support for second Super-IO chip")
Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
Cc: Jean Delvare <jdelvare@suse.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent ad66b968
...@@ -3115,7 +3115,7 @@ static int __init sm_it87_init(void) ...@@ -3115,7 +3115,7 @@ static int __init sm_it87_init(void)
{ {
int sioaddr[2] = { REG_2E, REG_4E }; int sioaddr[2] = { REG_2E, REG_4E };
struct it87_sio_data sio_data; struct it87_sio_data sio_data;
unsigned short isa_address; unsigned short isa_address[2];
bool found = false; bool found = false;
int i, err; int i, err;
...@@ -3125,15 +3125,29 @@ static int __init sm_it87_init(void) ...@@ -3125,15 +3125,29 @@ static int __init sm_it87_init(void)
for (i = 0; i < ARRAY_SIZE(sioaddr); i++) { for (i = 0; i < ARRAY_SIZE(sioaddr); i++) {
memset(&sio_data, 0, sizeof(struct it87_sio_data)); memset(&sio_data, 0, sizeof(struct it87_sio_data));
isa_address = 0; isa_address[i] = 0;
err = it87_find(sioaddr[i], &isa_address, &sio_data); err = it87_find(sioaddr[i], &isa_address[i], &sio_data);
if (err || isa_address == 0) if (err || isa_address[i] == 0)
continue; continue;
/*
* Don't register second chip if its ISA address matches
* the first chip's ISA address.
*/
if (i && isa_address[i] == isa_address[0])
break;
err = it87_device_add(i, isa_address, &sio_data); err = it87_device_add(i, isa_address[i], &sio_data);
if (err) if (err)
goto exit_dev_unregister; goto exit_dev_unregister;
found = true; found = true;
/*
* IT8705F may respond on both SIO addresses.
* Stop probing after finding one.
*/
if (sio_data.type == it87)
break;
} }
if (!found) { if (!found) {
......
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