Skip to content

Commit

Permalink
iio: frequency: adf4350: using an uninitialized variable
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Dan Carpenter authored and Greg Kroah-Hartman committed Jun 12, 2012
1 parent e86ee14 commit 1a135d1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/iio/frequency/adf4350.c
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ static ssize_t adf4350_write(struct iio_dev *indio_dev,
adf4350_sync_config(st);
break;
default:
ret = -ENODEV;
ret = -EINVAL;
}
mutex_unlock(&indio_dev->mlock);

Expand Down Expand Up @@ -311,7 +311,7 @@ static ssize_t adf4350_read(struct iio_dev *indio_dev,
val = !!(st->regs[ADF4350_REG2] & ADF4350_REG2_POWER_DOWN_EN);
break;
default:
ret = -ENODEV;
ret = -EINVAL;
}
mutex_unlock(&indio_dev->mlock);

Expand Down

0 comments on commit 1a135d1

Please sign in to comment.