Skip to contentSkip to conversation

Input: adxl34x - fix sparse warning

PATCH In review Dmitry Torokhov 3 participants 3 messages Oct 13, 2021 – Oct 15, 2021

Subsystems (3)
lore
Share & tools
lore

Dmitry Torokhov

author maintainer
#0 lore raw

PATCH 1/1 Input: adxl34x - fix sparse warning

This fixes the following warning from sparse:

CC [M] drivers/input/misc/adxl34x.o
CHECK drivers/input/misc/adxl34x.c
drivers/input/misc/adxl34x.c:245:29: warning: cast to restricted __le16 drivers/input/misc/adxl34x.c:248:29: warning: cast to restricted __le16 drivers/input/misc/adxl34x.c:251:29: warning: cast to restricted __le16

---
 drivers/input/misc/adxl34x.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/input/misc/adxl34x.c +1 -1
index 34beac80e6f0..a4af314392a9 100644
@@ -237,7 +237,7 @@ static const struct adxl34x_platform_data adxl34x_default_init = {
 
 static void adxl34x_get_triple(struct adxl34x *ac, struct axis_triple *axis)
 {
-	short buf[3];
+	__le16 buf[3];
 
 	ac->bops->read_block(ac->dev, DATAX0, DATAZ1 - DATAX0 + 1, buf);
 
Signature · 5 lines
2.33.0.882.g93a45727a2-goog


-- 
Dmitry
Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines · Dmitry Torokhov

This fixes the following warning from sparse:

CC [M] drivers/input/misc/adxl34x.o
CHECK drivers/input/misc/adxl34x.c
drivers/input/misc/adxl34x.c:245:29: warning: cast to restricted __le16 drivers/input/misc/adxl34x.c:248:29: warning: cast to restricted __le16 drivers/input/misc/adxl34x.c:251:29: warning: cast to restricted __le16

This was introduced (I think) in commit

	e27c729219ad ("Input: add driver for ADXL345/346 Digital Accelerometers")

. Is this worth a Fixes: line, or mentioning in the commit log?

Other than that:

Best regards
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |
maintainer Acked-by on v1 1/1
#2 lore raw
In reply to Dmitry Torokhov
Quoted 10 lines

-----Original Message-----
From: Dmitry Torokhov <[email protected]>
Sent: Mittwoch, 13. Oktober 2021 04:47
To: Hennerich, Michael <[email protected]>
Cc: Uwe Kleine-König <[email protected]>; linux- [email protected]; [email protected]
Subject: [PATCH] Input: adxl34x - fix sparse warning

This fixes the following warning from sparse:

Quoted 7 lines

CC [M] drivers/input/misc/adxl34x.o
CHECK drivers/input/misc/adxl34x.c
drivers/input/misc/adxl34x.c:245:29: warning: cast to restricted __le16 drivers/input/misc/adxl34x.c:248:29: warning: cast to restricted __le16 drivers/input/misc/adxl34x.c:251:29: warning: cast to restricted __le16

Quoted 23 lines
---
 drivers/input/misc/adxl34x.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/input/misc/adxl34x.c index renamed from drivers/input/misc/adxl34x.c +0 -0

34beac80e6f0..a4af314392a9 100644

drivers/input/misc/adxl34x.c +1 -2
@@ -237,7 +237,7 @@ static const struct adxl34x_platform_data
 adxl34x_default_init = {
 
 static void adxl34x_get_triple(struct adxl34x *ac, struct axis_triple *axis)  {
-	short buf[3];
+	__le16 buf[3];
 
 	ac->bops->read_block(ac->dev, DATAX0, DATAZ1 - DATAX0 + 1, buf);
 
--

2.33.0.882.g93a45727a2-goog

--
Dmitry