Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Dan Carpenter and committed by
Greg Kroah-Hartman
1a135d1a e86ee142

+2 -2
+2 -2
drivers/iio/frequency/adf4350.c
··· 272 272 adf4350_sync_config(st); 273 273 break; 274 274 default: 275 - ret = -ENODEV; 275 + ret = -EINVAL; 276 276 } 277 277 mutex_unlock(&indio_dev->mlock); 278 278 ··· 311 311 val = !!(st->regs[ADF4350_REG2] & ADF4350_REG2_POWER_DOWN_EN); 312 312 break; 313 313 default: 314 - ret = -ENODEV; 314 + ret = -EINVAL; 315 315 } 316 316 mutex_unlock(&indio_dev->mlock); 317 317