diff options
author | Alexandru Ardelean <alexandru.ardelean@analog.com> | 2020-04-15 08:58:03 +0300 |
---|---|---|
committer | Jonathan Cameron <Jonathan.Cameron@huawei.com> | 2020-04-19 17:50:03 +0100 |
commit | 8f2273b1e036f89bd04eb66bcb6f456eae8c98f1 (patch) | |
tree | 0f9f95aa13fdc37731bf9bcc8ff2021435a772ea /include/linux/iio | |
parent | a07479147be03d2450376ebaff9ea1a0682f25d6 (diff) | |
download | linux-8f2273b1e036f89bd04eb66bcb6f456eae8c98f1.tar.gz linux-8f2273b1e036f89bd04eb66bcb6f456eae8c98f1.tar.bz2 linux-8f2273b1e036f89bd04eb66bcb6f456eae8c98f1.zip |
iio: adc: ad7192: fix null pointer de-reference crash during probe
When the 'spi_device_id' table was removed, it omitted to cleanup/fix the
assignment:
'indio_dev->name = spi_get_device_id(spi)->name;'
After that patch 'spi_get_device_id(spi)' returns NULL, so this crashes
during probe with null de-ref.
This change fixes this by introducing an ad7192_chip_info struct, and
defines all part-names [that should be assigned to indio_dev->name] in a
'ad7192_chip_info_tbl' table.
With this change, the old 'st->devid' is also moved to be a
'chip_info->chip_id'. And the old 'ID_AD719X' macros have been renamed to
'CHIPID_AD719X'. Tld identifiers have been re-purposed to be enum/index
values in the new 'ad7192_chip_info_tbl'.
This should fix the bug, and maintain the ABI for the 'indio_dev->name'
field.
Fixes: 66614ab2be38 ("staging: iio: adc: ad7192: removed spi_device_id")
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'include/linux/iio')
0 files changed, 0 insertions, 0 deletions