Skip to content

Commit 1a135d1

Browse files
Dan Carpentergregkh
authored andcommitted
iio: frequency: adf4350: using an uninitialized variable
GCC complains that we use an uninitialized variable if the user passes an invalid parameter to adf4350_read(). I decided that we should return -EINVAL instead in that case. However, when I looked up at adf4350_write() it returned -ENODEV for that condition. In the end, I decided the -EINVAL was the right thing and I change adf4350_write() to match. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Acked-by: Michael Hennerich <michael.hennerich@analog.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent e86ee14 commit 1a135d1

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎drivers/iio/frequency/adf4350.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ static ssize_t adf4350_write(struct iio_dev *indio_dev,
272272
adf4350_sync_config(st);
273273
break;
274274
default:
275-
ret = -ENODEV;
275+
ret = -EINVAL;
276276
}
277277
mutex_unlock(&indio_dev->mlock);
278278

@@ -311,7 +311,7 @@ static ssize_t adf4350_read(struct iio_dev *indio_dev,
311311
val = !!(st->regs[ADF4350_REG2] & ADF4350_REG2_POWER_DOWN_EN);
312312
break;
313313
default:
314-
ret = -ENODEV;
314+
ret = -EINVAL;
315315
}
316316
mutex_unlock(&indio_dev->mlock);
317317

0 commit comments

Comments
 (0)