LKML Archive mirror
 help / color / mirror / Atom feed
* [PATCH] Input: ads7846 - fix pointer cast warning
@ 2023-06-09 20:27 Arnd Bergmann
  2023-06-09 21:05 ` Linus Walleij
  0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2023-06-09 20:27 UTC (permalink / raw)
  To: Dmitry Torokhov, Linus Walleij, Arnd Bergmann
  Cc: kernel test robot, Andy Shevchenko, Luca Ellero, Jonathan Cameron,
	linux-input, linux-kernel

From: Arnd Bergmann <arnd@arndb.de>

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.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202306100442.jStknDT1-lkp@intel.com/
Fixes: 8f7913c04f6a7 ("Input: ads7846 - Fix usage of match data")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
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(-)

diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c
index fe6fe8acd8a66..faea40dd66d01 100644
--- a/drivers/input/touchscreen/ads7846.c
+++ b/drivers/input/touchscreen/ads7846.c
@@ -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);
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Input: ads7846 - fix pointer cast warning
  2023-06-09 20:27 [PATCH] Input: ads7846 - fix pointer cast warning Arnd Bergmann
@ 2023-06-09 21:05 ` Linus Walleij
  0 siblings, 0 replies; 2+ messages in thread
From: Linus Walleij @ 2023-06-09 21:05 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Dmitry Torokhov, Arnd Bergmann, kernel test robot,
	Andy Shevchenko, Luca Ellero, Jonathan Cameron, linux-input,
	linux-kernel

On Fri, Jun 9, 2023 at 10:27 PM Arnd Bergmann <arnd@kernel.org> wrote:

> From: Arnd Bergmann <arnd@arndb.de>
>
> 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.
>
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202306100442.jStknDT1-lkp@intel.com/
> Fixes: 8f7913c04f6a7 ("Input: ads7846 - Fix usage of match data")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Excellent fix, thanks! Sorry for not predicting this.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-06-09 21:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-09 20:27 [PATCH] Input: ads7846 - fix pointer cast warning Arnd Bergmann
2023-06-09 21:05 ` Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).