diff options
author | Markus Burri <markus.burri@mt.com> | 2023-06-14 09:30:33 +0200 |
---|---|---|
committer | Jonathan Cameron <Jonathan.Cameron@huawei.com> | 2023-07-15 17:53:38 +0100 |
commit | f41f444334ea23ed071508f271109e2b6e878537 (patch) | |
tree | 6241eae6e20a5864f4c6eb9fbdaf7d9064d03bb0 /drivers | |
parent | 478baae99c714a14de98e9387ffdd009633fdee7 (diff) |
iio: adi: ad7192: Add error check and more debug log
Print read and expected device ID as debug warning.
Add error check for ad_sd_init() result.
Reviewed-by: Nuno Sa <nuno.sa@analog.com>
Signed-off-by: Markus Burri <markus.burri@mt.com>
Link: https://lore.kernel.org/r/20230614073033.2497318-1-markus.burri@mt.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/iio/adc/ad7192.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/iio/adc/ad7192.c b/drivers/iio/adc/ad7192.c index 5dcb257ad754..e23d9a7dcc9e 100644 --- a/drivers/iio/adc/ad7192.c +++ b/drivers/iio/adc/ad7192.c @@ -402,8 +402,8 @@ static int ad7192_setup(struct iio_dev *indio_dev, struct device_node *np) id &= AD7192_ID_MASK; if (id != st->chip_info->chip_id) - dev_warn(&st->sd.spi->dev, "device ID query failed (0x%X)\n", - id); + dev_warn(&st->sd.spi->dev, "device ID query failed (0x%X != 0x%X)\n", + id, st->chip_info->chip_id); st->mode = AD7192_MODE_SEL(AD7192_MODE_IDLE) | AD7192_MODE_CLKSRC(st->clock_sel) | @@ -1031,7 +1031,9 @@ static int ad7192_probe(struct spi_device *spi) else indio_dev->info = &ad7192_info; - ad_sd_init(&st->sd, indio_dev, spi, &ad7192_sigma_delta_info); + ret = ad_sd_init(&st->sd, indio_dev, spi, &ad7192_sigma_delta_info); + if (ret) + return ret; ret = devm_ad_sd_setup_buffer_and_trigger(&spi->dev, indio_dev); if (ret) |