public inbox for linux-iio@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] staging: iio: adc: ad7280a: fix overwrite of the returned value
@ 2018-12-02 11:42 Slawomir Stepien
  2018-12-02 15:36 ` Jonathan Cameron
  0 siblings, 1 reply; 2+ messages in thread
From: Slawomir Stepien @ 2018-12-02 11:42 UTC (permalink / raw)
  To: lars, Michael.Hennerich, jic23, knaack.h, pmeerw; +Cc: linux-iio, gregkh

The ret returned from ad7280_chain_setup() is needed to initialize the
slave_num. Don't overwrite it with call to devm_add_action_or_reset().

Fixes: cc9c58ef6e06 ("staging: iio: adc: ad7280a: use devm_* APIs")
Signed-off-by: Slawomir Stepien <sst@poczta.fm>
---
 drivers/staging/iio/adc/ad7280a.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/iio/adc/ad7280a.c b/drivers/staging/iio/adc/ad7280a.c
index 7a0ba26f9fd9..14f6a3ced060 100644
--- a/drivers/staging/iio/adc/ad7280a.c
+++ b/drivers/staging/iio/adc/ad7280a.c
@@ -879,15 +879,15 @@ static int ad7280_probe(struct spi_device *spi)
 	if (ret < 0)
 		return ret;
 
-	ret = devm_add_action_or_reset(&spi->dev, ad7280_sw_power_down, st);
-	if (ret)
-		return ret;
-
 	st->slave_num = ret;
 	st->scan_cnt = (st->slave_num + 1) * AD7280A_NUM_CH;
 	st->cell_threshhigh = 0xFF;
 	st->aux_threshhigh = 0xFF;
 
+	ret = devm_add_action_or_reset(&spi->dev, ad7280_sw_power_down, st);
+	if (ret)
+		return ret;
+
 	/*
 	 * Total Conversion Time = ((tACQ + tCONV) *
 	 *			   (Number of Conversions per Part)) −
-- 
2.19.2


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

end of thread, other threads:[~2018-12-02 15:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-02 11:42 [PATCH 1/1] staging: iio: adc: ad7280a: fix overwrite of the returned value Slawomir Stepien
2018-12-02 15:36 ` Jonathan Cameron

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