Linux IIO development
 help / color / mirror / Atom feed
* [PATCH] iio: dac: ti-dac7311: Add check for spi_setup
@ 2024-07-05  8:42 Chen Ni
  2024-07-07 14:15 ` Jonathan Cameron
  0 siblings, 1 reply; 2+ messages in thread
From: Chen Ni @ 2024-07-05  8:42 UTC (permalink / raw)
  To: jic23, lars; +Cc: linux-iio, linux-kernel, Chen Ni

Add check for the return value of spi_setup() and return the error
if it fails in order to catch the error.

Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
---
 drivers/iio/dac/ti-dac7311.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/dac/ti-dac7311.c b/drivers/iio/dac/ti-dac7311.c
index 7f89d2a52f49..8e8a8ab0ebf6 100644
--- a/drivers/iio/dac/ti-dac7311.c
+++ b/drivers/iio/dac/ti-dac7311.c
@@ -249,7 +249,11 @@ static int ti_dac_probe(struct spi_device *spi)
 
 	spi->mode = SPI_MODE_1;
 	spi->bits_per_word = 16;
-	spi_setup(spi);
+	ret = spi_setup(spi);
+	if (ret < 0) {
+		dev_err(dev, "spi_setup failed\n");
+		return ret;
+	}
 
 	indio_dev->info = &ti_dac_info;
 	indio_dev->name = spi_get_device_id(spi)->name;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-07-07 14:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-05  8:42 [PATCH] iio: dac: ti-dac7311: Add check for spi_setup Chen Ni
2024-07-07 14:15 ` Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox