patch "iio: light: opt4001: Fix incompatible pointer type passed to" added to char-misc-testing
Subsystems (2)
This is a note to let you know that I've just added the patch titled
iio: light: opt4001: Fix incompatible pointer type passed to
to my char-misc git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git
in the char-misc-testing branch.
The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.)
The patch will be merged to the char-misc-next branch sometime soon, after it passes testing, and the merge window is open.
If you have any questions about this process, please let me know.
From afa28741c9a2cf6edb2e41e25ff146a562160bb3 Mon Sep 17 00:00:00 2001
From: Nikhil Gautam <[email protected]>
Date: Tue, 14 Jul 2026 17:01:32 +0530
Subject: iio: light: opt4001: Fix incompatible pointer type passed to
div_u64_rem()
div_u64_rem() takes a u32 * for the remainder but is passed val2, which is an int *. There is no functional impact as int and u32 have the same size and representation on all supported architectures and the remainder is always smaller than the divisor, so it fits in the positive range of int. Fix the type mismatch by using a local u32 for the remainder and assigning the result to *val2.
--- drivers/iio/light/opt4001.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/iio/light/opt4001.c +3 -2
@@ -173,6 +173,7 @@ static int opt4001_read_lux_value(struct iio_dev *indio_dev,u8 crc;u8 calc_crc;u64 lux_raw; +u32 rem;int ret; ret =regmap_read (chip->regmap,OPT4001_LIGHT1_MSB , &light1);
@@ -199,8 +200,8 @@ static int opt4001_read_lux_value(struct iio_dev *indio_dev, lux_raw = lux_raw << exp; lux_raw = lux_raw * chip->chip_info->mul; - *val =div_u64_rem (lux_raw, chip->chip_info->div, val2); - *val2 = *val2 *100 ; + *val =div_u64_rem (lux_raw, chip->chip_info->div, &rem); + *val2 = rem *100 ;return IIO_VAL_INT_PLUS_NANO ; }
Signature · 1 line
2.55.0