forked from Minki/linux
Fix crash due to NULL pointer access in max1111 driver
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABAgAGBQJW+pIoAAoJEMsfJm/On5mBr6sP/3H7ZTXw43V6SvMP3tK63Gn2 T9HtYyYJ2i7b9lfexqIV4gkC5wZiR4KwiWjYQrKfzMk9kvKWQ63O6rO6unbfjnUa gKTIXiId1nIcpmp0TqIFfQqf0j/Bqdbp0Qq7oKXTKB6+hEuvR96jsLVwlIQrRN6X 83oxcgQPvo8jOSeSew64S7PTIxqgomu9HKGwrjfSumxkYxUX/hm5lgU7b86lzQGF MeN/1oS6emTN+DhYazoQyc37/9mjRWiHXoJRYrqRauYvmbIFaML8ty498wi0G781 rLyVCRXEml9YBT2AJm9epni0RBvhz1wgNX96OFgZndevjiY7ZX8XQXKqjeseUQ6A B8aqNz2oapNxFNtIKU5+Q2VVfNUDkUEawJIfSsJEOMT+jY+NDx3W3xc5Wh3+FnYm GX8uX9CLNU1Wj2UcQC78IhZvVcGKtEeQv8j4kqu7YP0IdyjTsSYG2o0LueEGob8L JdkCJwKV9cEHccj9DK5KCz0jQX1jimS98FP0yWHYVQPtDr0M+NuB29FbYgbVT/0O Ng8R/8nDhtsU33JY6I0Xi6a38/5belDqmpLgdpatuSBonOhzq8o4XRV05/2u05El PSDiCHLXjUJqdIUBQW2G7+GYXzpocSYzm6ZLHitZYNYGDdYk2DpBqt4hOcg5oL/t vi3rstE18Jye/NJR15zD =CA84 -----END PGP SIGNATURE----- Merge tag 'hwmon-for-linus-v4.6-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging Pull hwmon fix from Guenter Roeck: "Fix crash due to NULL pointer access in max1111 driver" * tag 'hwmon-for-linus-v4.6-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging: hwmon: (max1111) Return -ENODEV from max1111_read_channel if not instantiated
This commit is contained in:
commit
8b8c877feb
@ -85,6 +85,9 @@ static struct max1111_data *the_max1111;
|
||||
|
||||
int max1111_read_channel(int channel)
|
||||
{
|
||||
if (!the_max1111 || !the_max1111->spi)
|
||||
return -ENODEV;
|
||||
|
||||
return max1111_read(&the_max1111->spi->dev, channel);
|
||||
}
|
||||
EXPORT_SYMBOL(max1111_read_channel);
|
||||
@ -258,6 +261,9 @@ static int max1111_remove(struct spi_device *spi)
|
||||
{
|
||||
struct max1111_data *data = spi_get_drvdata(spi);
|
||||
|
||||
#ifdef CONFIG_SHARPSL_PM
|
||||
the_max1111 = NULL;
|
||||
#endif
|
||||
hwmon_device_unregister(data->hwmon_dev);
|
||||
sysfs_remove_group(&spi->dev.kobj, &max1110_attr_group);
|
||||
sysfs_remove_group(&spi->dev.kobj, &max1111_attr_group);
|
||||
|
Loading…
Reference in New Issue
Block a user