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

Configure Feed

Select the types of activity you want to include in your feed.

iio: adc: ad4000: don't use shift_right()

Drop use of shift_right() macro for unsigned value. The shift_right()
macro is intended for signed values and is not needed for unsigned
values.

This was found by a static analysis tool [1].

Link: https://github.com/analogdevicesinc/linux/pull/2831/files#diff-c14a34a6492576d22e7192cc0f61ad0083190aeb627191596fe12462f0c6f21aR557 [1]
Signed-off-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Marcelo Schmitt <marcelo.schmitt@analog.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Link: https://patch.msgid.link/20250702-iio-adc-ad4000-don-t-use-shift_right-v1-1-041c2d6c3950@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

David Lechner and committed by
Jonathan Cameron
1b0dc938 219da3ea

+1 -1
+1 -1
drivers/iio/adc/ad4000.c
··· 554 554 val = mult_frac(st->vref_mv, MICRO, st->gain_milli); 555 555 556 556 /* Would multiply by NANO here but we multiplied by extra MILLI */ 557 - tmp2 = shift_right((u64)val * MICRO, scale_bits); 557 + tmp2 = (u64)val * MICRO >> scale_bits; 558 558 tmp0 = div_s64_rem(tmp2, NANO, &tmp1); 559 559 560 560 /* Store scale for when span compression is disabled */