Skip to content

Commit 2a961d0

Browse files
Marek Vasutjic23
authored andcommitted
iio: mxs-lradc: Remove useless check in read_raw
The removed check in the read_raw implementation was always true, therefore remove it. This also fixes a bug, by closely inspecting the code, one can notice the iio_validate_scan_mask_onehot() will always return 1 and therefore the subsequent condition will always succeed, therefore making the mxs_lradc_read_raw() function always return -EINVAL; . Signed-off-by: Marek Vasut <[email protected]> Tested-by: Otavio Salvador <[email protected]> Acked-by: Hector Palacios <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
1 parent e1b1fa6 commit 2a961d0

File tree

1 file changed

+0
-7
lines changed

1 file changed

+0
-7
lines changed

drivers/staging/iio/adc/mxs-lradc.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,6 @@ static int mxs_lradc_read_raw(struct iio_dev *iio_dev,
234234
{
235235
struct mxs_lradc *lradc = iio_priv(iio_dev);
236236
int ret;
237-
unsigned long mask;
238237

239238
if (m != IIO_CHAN_INFO_RAW)
240239
return -EINVAL;
@@ -243,12 +242,6 @@ static int mxs_lradc_read_raw(struct iio_dev *iio_dev,
243242
if (chan->channel > LRADC_MAX_TOTAL_CHANS)
244243
return -EINVAL;
245244

246-
/* Validate the channel if it doesn't intersect with reserved chans. */
247-
bitmap_set(&mask, chan->channel, 1);
248-
ret = iio_validate_scan_mask_onehot(iio_dev, &mask);
249-
if (ret)
250-
return -EINVAL;
251-
252245
/*
253246
* See if there is no buffered operation in progess. If there is, simply
254247
* bail out. This can be improved to support both buffered and raw IO at

0 commit comments

Comments
 (0)