mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-09-11 20:45:57 -04:00
iio: dac: ad5686: missing NULL check on match data
Verify that chip_info pointer is not NULL. If a user binds the driver
using driver_override via sysfs with a device name not present in the
id_table or of_match_table, match data will be NULL.
Fixes: 0eb1728461 ("iio: dac: ad5686: drop enum id")
Reported-by: sashiko-bot@kernel.org
Closes: https://lore.kernel.org/all/20260710113149.53EC51F000E9@smtp.kernel.org/
Signed-off-by: Rodrigo Alencar <rodrigo.alencar@analog.com>
Reviewed-by: Joshua Crofts <joshua.crofts1@gmail.com>
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
This commit is contained in:
committed by
Jonathan Cameron
parent
a1c5ca7b80
commit
572a008526
@@ -98,8 +98,13 @@ static const struct ad5686_bus_ops ad5686_spi_ops = {
|
||||
|
||||
static int ad5686_spi_probe(struct spi_device *spi)
|
||||
{
|
||||
return ad5686_probe(&spi->dev, spi_get_device_match_data(spi),
|
||||
spi->modalias, &ad5686_spi_ops);
|
||||
const struct ad5686_chip_info *info;
|
||||
|
||||
info = spi_get_device_match_data(spi);
|
||||
if (!info)
|
||||
return -ENODATA;
|
||||
|
||||
return ad5686_probe(&spi->dev, info, spi->modalias, &ad5686_spi_ops);
|
||||
}
|
||||
|
||||
static const struct spi_device_id ad5686_spi_id[] = {
|
||||
|
||||
@@ -68,8 +68,13 @@ static const struct ad5686_bus_ops ad5686_i2c_ops = {
|
||||
|
||||
static int ad5686_i2c_probe(struct i2c_client *i2c)
|
||||
{
|
||||
return ad5686_probe(&i2c->dev, i2c_get_match_data(i2c),
|
||||
i2c->name, &ad5686_i2c_ops);
|
||||
const struct ad5686_chip_info *info;
|
||||
|
||||
info = i2c_get_match_data(i2c);
|
||||
if (!info)
|
||||
return -ENODATA;
|
||||
|
||||
return ad5686_probe(&i2c->dev, info, i2c->name, &ad5686_i2c_ops);
|
||||
}
|
||||
|
||||
static const struct i2c_device_id ad5686_i2c_id[] = {
|
||||
|
||||
Reference in New Issue
Block a user