Skip to contentSkip to conversation

Input: ads7846 - fix pointer cast warning

PATCH In review Arnd Bergmann 2 participants 2 messages Jun 9, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Input: ads7846 - fix pointer cast warning

From: Arnd Bergmann <[email protected]>

The previous bugfix caused a warning on 64-bit builds:

drivers/input/touchscreen/ads7846.c:1126:17: warning: cast to smaller integer type 'u32' (aka 'unsigned int') from 'const void *' [-Wvoid-pointer-to-int-cast]

Change the cast back to something that works on both 32-bit and 64-bit kernels.

Fixes 8f7913c04f6a7 ("Input: ads7846 - Fix usage of match data")

---
I got the report and applied this locally to fix it quickly

 drivers/input/touchscreen/ads7846.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/input/touchscreen/ads7846.c +1 -1
index fe6fe8acd8a66..faea40dd66d01 100644
@@ -1123,7 +1123,7 @@ static const struct ads7846_platform_data *ads7846_get_props(struct device *dev)
 	if (!pdata)
 		return ERR_PTR(-ENOMEM);
 
-	pdata->model = (u32)device_get_match_data(dev);
+	pdata->model = (uintptr_t)device_get_match_data(dev);
 
 	device_property_read_u16(dev, "ti,vref-delay-usecs",
 				 &pdata->vref_delay_usecs);
Signature · 1 line
2.39.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

The previous bugfix caused a warning on 64-bit builds:

drivers/input/touchscreen/ads7846.c:1126:17: warning: cast to smaller integer type 'u32' (aka 'unsigned int') from 'const void *' [-Wvoid-pointer-to-int-cast]

Quoted 7 lines

Change the cast back to something that works on both 32-bit and 64-bit kernels.

Fixes 8f7913c04f6a7 ("Input: ads7846 - Fix usage of match data")

Excellent fix, thanks! Sorry for not predicting this.

Yours,
Linus Walleij