[PATCH 04/22] drivers: don't cast pointer directly to enum

Ahmad Fatoum a.fatoum at pengutronix.de
Thu Mar 13 00:34:27 PDT 2025


64-bit Sandbox builds with clang don't like the direct cast of
a 64-bit pointer to a 32-bit enum value. Add an uintptr_t in between
to loosen up the atmosphere.

Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 drivers/aiodev/lm75.c        | 2 +-
 drivers/net/ksz8864rmn.c     | 2 +-
 drivers/regulator/fan53555.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/aiodev/lm75.c b/drivers/aiodev/lm75.c
index 13b7ac4710c2..86eac091d8d3 100644
--- a/drivers/aiodev/lm75.c
+++ b/drivers/aiodev/lm75.c
@@ -110,7 +110,7 @@ static int lm75_probe(struct device *dev)
 	int new, ret;
 	enum lm75_type kind;
 
-	kind = (enum lm75_type)device_get_match_data(dev);
+	kind = (enum lm75_type)(uintptr_t)device_get_match_data(dev);
 	if (kind == unknown)
 		return -ENODEV;
 
diff --git a/drivers/net/ksz8864rmn.c b/drivers/net/ksz8864rmn.c
index c4c30377af83..8cec0bb02678 100644
--- a/drivers/net/ksz8864rmn.c
+++ b/drivers/net/ksz8864rmn.c
@@ -126,7 +126,7 @@ static int micrel_switch_probe(struct device *dev)
 {
 	struct micrel_switch_priv *priv;
 	int ret = 0;
-	enum ksz_type kind = (enum ksz_type)device_get_match_data(dev);
+	enum ksz_type kind = (enum ksz_type)(uintptr_t)device_get_match_data(dev);
 	uint8_t id;
 
 	if (kind == unknown)
diff --git a/drivers/regulator/fan53555.c b/drivers/regulator/fan53555.c
index f73511b36b20..2df0d2410a03 100644
--- a/drivers/regulator/fan53555.c
+++ b/drivers/regulator/fan53555.c
@@ -384,7 +384,7 @@ static int fan53555_regulator_probe(struct device *dev)
 
 	di = xzalloc(sizeof(*di));
 
-	di->vendor = (enum fan53555_vendor)device_get_match_data(dev);
+	di->vendor = (enum fan53555_vendor)(uintptr_t)device_get_match_data(dev);
 
 	di->rdev.desc = &di->rdesc;
 	di->rdev.dev = dev;
-- 
2.39.5




More information about the barebox mailing list