Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2a961d09 authored by Marek Vasut's avatar Marek Vasut Committed by Jonathan Cameron
Browse files

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: default avatarMarek Vasut <marex@denx.de>
Tested-by: default avatarOtavio Salvador <otavio@ossystems.com.br>
Acked-by: default avatarHector Palacios <hector.palacios@digi.com>
Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
parent e1b1fa66
Loading
Loading
Loading
Loading
+0 −7
Original line number Original line Diff line number Diff line
@@ -234,7 +234,6 @@ static int mxs_lradc_read_raw(struct iio_dev *iio_dev,
{
{
	struct mxs_lradc *lradc = iio_priv(iio_dev);
	struct mxs_lradc *lradc = iio_priv(iio_dev);
	int ret;
	int ret;
	unsigned long mask;


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


	/* Validate the channel if it doesn't intersect with reserved chans. */
	bitmap_set(&mask, chan->channel, 1);
	ret = iio_validate_scan_mask_onehot(iio_dev, &mask);
	if (ret)
		return -EINVAL;

	/*
	/*
	 * See if there is no buffered operation in progess. If there is, simply
	 * See if there is no buffered operation in progess. If there is, simply
	 * bail out. This can be improved to support both buffered and raw IO at
	 * bail out. This can be improved to support both buffered and raw IO at