summaryrefslogtreecommitdiff
path: root/drivers/staging/iio/resolver/ad2s1210.c
diff options
context:
space:
mode:
authorDavid Lechner <dlechner@baylibre.com>2023-09-29 20:23:09 +0300
committerJonathan Cameron <Jonathan.Cameron@huawei.com>2023-09-30 17:37:15 +0300
commit3c1f41d5f320a001507257ca3504716e8f8bc00c (patch)
tree7ccd645c63b37eddc6a33c57566405f535ffc518 /drivers/staging/iio/resolver/ad2s1210.c
parent9829ebacea804ad4b5d1a74a8d94a1f843505546 (diff)
downloadlinux-3c1f41d5f320a001507257ca3504716e8f8bc00c.tar.xz
staging: iio: resolver: ad2s1210: check return of ad2s1210_initial()
This adds a check to the return value of ad2s1210_initial() since it can fail. The call is also moved before devm_iio_device_register() so that we don't have to unregister the device if it fails. Signed-off-by: David Lechner <dlechner@baylibre.com> Link: https://lore.kernel.org/r/20230929-ad2s1210-mainline-v3-4-fa4364281745@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/staging/iio/resolver/ad2s1210.c')
-rw-r--r--drivers/staging/iio/resolver/ad2s1210.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/staging/iio/resolver/ad2s1210.c b/drivers/staging/iio/resolver/ad2s1210.c
index 8fde08887f7f..b5e071d7c5fd 100644
--- a/drivers/staging/iio/resolver/ad2s1210.c
+++ b/drivers/staging/iio/resolver/ad2s1210.c
@@ -672,6 +672,10 @@ static int ad2s1210_probe(struct spi_device *spi)
if (ret < 0)
return ret;
+ ret = ad2s1210_initial(st);
+ if (ret < 0)
+ return ret;
+
indio_dev->info = &ad2s1210_info;
indio_dev->modes = INDIO_DIRECT_MODE;
indio_dev->channels = ad2s1210_channels;
@@ -683,7 +687,6 @@ static int ad2s1210_probe(struct spi_device *spi)
return ret;
st->fclkin = spi->max_speed_hz;
- ad2s1210_initial(st);
return 0;
}