Skip to contentSkip to conversation

iio:cdc:ad7150: Fix use of uninitialized ret

PATCH In review Jonathan Cameron 1 participant 2 messages Apr 6, 2021

Subsystems (2)
lore
Share & tools
lore

Jonathan Cameron

author maintainer
#0 lore raw

PATCH 1/1 iio:cdc:ad7150: Fix use of uninitialized ret

From: Jonathan Cameron <[email protected]>

This doesn't appear to generate a warning on all versions of GCC, but 0-day reported it and the report looks valid.

---
 drivers/iio/cdc/ad7150.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/cdc/ad7150.c +1 -1
index f9cce1a64586..ebe112b4618b 100644
@@ -235,7 +235,7 @@ static int ad7150_write_event_config(struct iio_dev *indio_dev,
 				     enum iio_event_direction dir, int state)
 {
 	struct ad7150_chip_info *chip = iio_priv(indio_dev);
-	int ret;
+	int ret = 0;
 
 	/*
 	 * There is only a single shared control and no on chip
Signature · 1 line
2.31.1
author maintainer
#1 lore raw
Quoted 7 lines · On Tue, 6 Apr 2021 09:32:44 +0100 Jonathan Cameron <[email protected]> wrote:

From: Jonathan Cameron <[email protected]>

This doesn't appear to generate a warning on all versions of GCC, but 0-day reported it and the report looks valid.

For this one, it's the sort of thing I'd normally just roll into the original patch, but there is a merge in my tree after this, so in the interests of simplicity I've applied it on top.

Applied to the togreg branch of iio.git and pushed out as testing for the autobuilders to take another look at it and see what I got wrong this time :)

Jonathan

Quoted 17 lines
---
 drivers/iio/cdc/ad7150.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/cdc/ad7150.c +1 -1
index f9cce1a64586..ebe112b4618b 100644
@@ -235,7 +235,7 @@ static int ad7150_write_event_config(struct iio_dev *indio_dev,
 				     enum iio_event_direction dir, int state)
 {
 	struct ad7150_chip_info *chip = iio_priv(indio_dev);
-	int ret;
+	int ret = 0;
 
 	/*
 	 * There is only a single shared control and no on chip