mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] regulator: da9121: Fix Wvoid-pointer-to-enum-cast warning
@ 2025-05-09 14:24 Krzysztof Kozlowski
  2025-05-11  1:54 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Krzysztof Kozlowski @ 2025-05-09 14:24 UTC (permalink / raw)
  To: Support Opensource, Liam Girdwood, Mark Brown, Nathan Chancellor,
	Nick Desaulniers, Bill Wendling, Justin Stitt, linux-kernel,
	llvm
  Cc: Krzysztof Kozlowski

'subvariant_id' is an enum, thus cast of pointer on 64-bit compile test
with clang and W=1 causes:

  da9121-regulator.c:1132:24: error: cast to smaller integer type 'enum da9121_subvariant' from 'const void *' [-Werror,-Wvoid-pointer-to-enum-cast]

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

---

One of the discussions in 2023 on LKML suggested warning is not suitable
for kernel, however other points were that we actually want these to be
fixed (IIUC):
  https://lore.kernel.org/all/20230814160457.GA2836@dev-arch.thelio-3990X/

Nothing changed in disabling the warning for more than a year, so assume
the warning will stay and we really want to have warnings-free builds.
---
 drivers/regulator/da9121-regulator.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/regulator/da9121-regulator.c b/drivers/regulator/da9121-regulator.c
index 17527a3f53b4..ef161eb0ca27 100644
--- a/drivers/regulator/da9121-regulator.c
+++ b/drivers/regulator/da9121-regulator.c
@@ -1129,7 +1129,7 @@ static int da9121_i2c_probe(struct i2c_client *i2c)
 	}
 
 	chip->pdata = i2c->dev.platform_data;
-	chip->subvariant_id = (enum da9121_subvariant)i2c_get_match_data(i2c);
+	chip->subvariant_id = (kernel_ulong_t)i2c_get_match_data(i2c);
 
 	ret = da9121_assign_chip_model(i2c, chip);
 	if (ret < 0)
-- 
2.45.2


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

end of thread, other threads:[~2025-05-11  1:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-05-09 14:24 [PATCH] regulator: da9121: Fix Wvoid-pointer-to-enum-cast warning Krzysztof Kozlowski
2025-05-11  1:54 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®