mirror of
https://github.com/torvalds/linux.git
synced 2026-11-06 21:58:01 +01:00
iio: amplifiers: ad8366: reject devices without match data
A device bound through driver_override need not match an entry in the
driver tables. In that case spi_get_device_match_data() returns NULL,
but ad8366_probe() later dereferences the result while setting up the
IIO device.
Reject devices without match data before using the chip information.
Fixes: d5e02d0d00 ("iio: amplifiers: ad8366: add device tree support")
Signed-off-by: Jiale Yao <yaojiale02@163.com>
Cc: stable@vger.kernel.org
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
This commit is contained in:
parent
eb48e411a3
commit
a3f438368c
|
|
@ -326,6 +326,8 @@ static int ad8366_probe(struct spi_device *spi)
|
|||
|
||||
st->spi = spi;
|
||||
st->info = spi_get_device_match_data(spi);
|
||||
if (!st->info)
|
||||
return -ENODATA;
|
||||
|
||||
enable_gpio = devm_gpiod_get_optional(dev, "enable", GPIOD_OUT_HIGH);
|
||||
if (IS_ERR(enable_gpio))
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user