Skip to content
Commit f890987f authored by Wilfried Wessner's avatar Wilfried Wessner Committed by Jonathan Cameron
Browse files

iio: adc: ad7949: fix wrong ADC result due to incorrect bit mask



Fixes a wrong bit mask used for the ADC's result, which was caused by an
improper usage of the GENMASK() macro. The bits higher than ADC's
resolution are undefined and if not masked out correctly, a wrong result
can be given. The GENMASK() macro indexing is zero based, so the mask has
to go from [resolution - 1 , 0].

Fixes: 7f40e061 ("iio:adc:ad7949: Add AD7949 ADC driver family")
Signed-off-by: default avatarWilfried Wessner <wilfried.wessner@gmail.com>
Reviewed-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: default avatarCharles-Antoine Couret <charles-antoine.couret@essensium.com>
Cc: <Stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20210208142705.GA51260@ubuntu


Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent d68c592e
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