drivers/iio/health/max30100.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Drop an unnecessary cast in max30100_led_init().
val is defined as unsigned int val[2]; so the cast is not needed, nor
is the address-of operator &.
Also fix alignment with ( while we are touching this.
Signed-off-by: David Lechner <dlechner@baylibre.com>
---
drivers/iio/health/max30100.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iio/health/max30100.c b/drivers/iio/health/max30100.c
index 7dfdb5eb305e..00dca1c9425c 100644
--- a/drivers/iio/health/max30100.c
+++ b/drivers/iio/health/max30100.c
@@ -274,7 +274,7 @@ static int max30100_led_init(struct max30100_data *data)
int reg, ret;
ret = device_property_read_u32_array(dev, "maxim,led-current-microamp",
- (unsigned int *) &val, 2);
+ val, 2);
if (ret) {
/* Default to 24 mA RED LED, 50 mA IR LED */
reg = (MAX30100_REG_LED_CONFIG_24MA <<
---
base-commit: ff0843ceb1fb11a6b73e0e77b932ef7967aecd4b
change-id: 20260314-iio-health-max301000-drop-int-cast-f34f3493e0f7
Best regards,
--
David Lechner <dlechner@baylibre.com>
On Sat, Mar 14, 2026 at 05:33:01PM -0500, David Lechner wrote: > Drop an unnecessary cast in max30100_led_init(). > > val is defined as unsigned int val[2]; so the cast is not needed, nor > is the address-of operator &. > > Also fix alignment with ( while we are touching this. > ret = device_property_read_u32_array(dev, "maxim,led-current-microamp", > - (unsigned int *) &val, 2); > + val, 2); You want to have ARRAY_SIZE() as well. -- With Best Regards, Andy Shevchenko
On Mon, 16 Mar 2026 13:25:00 +0200 Andy Shevchenko <andriy.shevchenko@intel.com> wrote: > On Sat, Mar 14, 2026 at 05:33:01PM -0500, David Lechner wrote: > > Drop an unnecessary cast in max30100_led_init(). > > > > val is defined as unsigned int val[2]; so the cast is not needed, nor > > is the address-of operator &. > > > > Also fix alignment with ( while we are touching this. > > > ret = device_property_read_u32_array(dev, "maxim,led-current-microamp", > > - (unsigned int *) &val, 2); > > + val, 2); > > You want to have ARRAY_SIZE() as well. > Should we make val a u32 val[2]? Obviously we all know the unsigned int is that big, but in theory that might not always be so... This is the only place where it's passed as a pointer rather than value from one of the elements I think.
© 2016 - 2026 Red Hat, Inc.