Commit 1a135d1a authored by Dan Carpenter's avatar Dan Carpenter Committed by Greg Kroah-Hartman

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: default avatarDan Carpenter <dan.carpenter@oracle.com>
Acked-by: default avatarMichael Hennerich <michael.hennerich@analog.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent e86ee142
...@@ -272,7 +272,7 @@ static ssize_t adf4350_write(struct iio_dev *indio_dev, ...@@ -272,7 +272,7 @@ static ssize_t adf4350_write(struct iio_dev *indio_dev,
adf4350_sync_config(st); adf4350_sync_config(st);
break; break;
default: default:
ret = -ENODEV; ret = -EINVAL;
} }
mutex_unlock(&indio_dev->mlock); mutex_unlock(&indio_dev->mlock);
...@@ -311,7 +311,7 @@ static ssize_t adf4350_read(struct iio_dev *indio_dev, ...@@ -311,7 +311,7 @@ static ssize_t adf4350_read(struct iio_dev *indio_dev,
val = !!(st->regs[ADF4350_REG2] & ADF4350_REG2_POWER_DOWN_EN); val = !!(st->regs[ADF4350_REG2] & ADF4350_REG2_POWER_DOWN_EN);
break; break;
default: default:
ret = -ENODEV; ret = -EINVAL;
} }
mutex_unlock(&indio_dev->mlock); mutex_unlock(&indio_dev->mlock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment