[PATCH net-next] reset: hisilicon: hi6220: fix Wvoid-pointer-to-enum-cast warning

Krzysztof Kozlowski posted 1 patch 2 years, 6 months ago
drivers/reset/hisilicon/hi6220_reset.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH net-next] reset: hisilicon: hi6220: fix Wvoid-pointer-to-enum-cast warning
Posted by Krzysztof Kozlowski 2 years, 6 months ago
'type' is an enum, thus cast of pointer on 64-bit compile test with W=1
causes:

  hi6220_reset.c:166:9: error: cast to smaller integer type 'enum hi6220_reset_ctrl_type' from 'const void *' [-Werror,-Wvoid-pointer-to-enum-cast]

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
---
 drivers/reset/hisilicon/hi6220_reset.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/reset/hisilicon/hi6220_reset.c b/drivers/reset/hisilicon/hi6220_reset.c
index 8d1fce18ded7..5c3267acd2b1 100644
--- a/drivers/reset/hisilicon/hi6220_reset.c
+++ b/drivers/reset/hisilicon/hi6220_reset.c
@@ -163,7 +163,7 @@ static int hi6220_reset_probe(struct platform_device *pdev)
 	if (!data)
 		return -ENOMEM;
 
-	type = (enum hi6220_reset_ctrl_type)of_device_get_match_data(dev);
+	type = (uintptr_t)of_device_get_match_data(dev);
 
 	regmap = syscon_node_to_regmap(np);
 	if (IS_ERR(regmap)) {
-- 
2.34.1
Re: [PATCH net-next] reset: hisilicon: hi6220: fix Wvoid-pointer-to-enum-cast warning
Posted by Philipp Zabel 2 years, 2 months ago
On Thu, 10 Aug 2023 11:13:00 +0200, Krzysztof Kozlowski wrote:
> 'type' is an enum, thus cast of pointer on 64-bit compile test with W=1
> causes:
> 
>   hi6220_reset.c:166:9: error: cast to smaller integer type 'enum hi6220_reset_ctrl_type' from 'const void *' [-Werror,-Wvoid-pointer-to-enum-cast]
> 
> 

Applied to reset/fixes, thanks!

[1/1] reset: hisilicon: hi6220: fix Wvoid-pointer-to-enum-cast warning
      https://git.pengutronix.de/cgit/pza/linux/commit/?id=b5ec29447279

regards
Philipp