2024-06-06 14:59:52

by Krzysztof Kozlowski

[permalink] [raw]
Subject: [PATCH 1/3] mfd: max14577: Fix Wvoid-pointer-to-enum-cast warning (again)

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

max14577.c:400:23: error: cast to smaller integer type 'enum maxim_device_type' from 'const void *' [-Werror,-Wvoid-pointer-to-enum-cast]

Year ago this was solved, although LKML discussion suggested warning is
not suitable for kernel. Nothing changed in this regard for a year, so
assume the warning will stay and we want to have warnings-free builds.

Link: https://lore.kernel.org/all/[email protected]/
Link: https://lore.kernel.org/all/[email protected]/
Signed-off-by: Krzysztof Kozlowski <[email protected]>
---
drivers/mfd/max14577.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mfd/max14577.c b/drivers/mfd/max14577.c
index 8f7472c76009..67bf4de4c0c1 100644
--- a/drivers/mfd/max14577.c
+++ b/drivers/mfd/max14577.c
@@ -397,7 +397,7 @@ static int max14577_i2c_probe(struct i2c_client *i2c)
return ret;
}

- max14577->dev_type = (enum maxim_device_type)i2c_get_match_data(i2c);
+ max14577->dev_type = (kernel_ulong_t)i2c_get_match_data(i2c);

max14577_print_dev_type(max14577);

--
2.43.0



2024-06-06 15:12:29

by Krzysztof Kozlowski

[permalink] [raw]
Subject: [PATCH 2/3] mfd: mxs-lradc: Fix Wvoid-pointer-to-enum-cast warning (again)

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

mxs-lradc.c:140:15: error: cast to smaller integer type 'enum mxs_lradc_id' from 'const void *' [-Werror,-Wvoid-pointer-to-enum-cast]

Year ago this was solved, although LKML discussion suggested warning is
not suitable for kernel. Nothing changed in this regard for a year, so
assume the warning will stay and we want to have warnings-free builds.

Link: https://lore.kernel.org/all/[email protected]/
Link: https://lore.kernel.org/all/[email protected]/
Signed-off-by: Krzysztof Kozlowski <[email protected]>
---
drivers/mfd/mxs-lradc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mfd/mxs-lradc.c b/drivers/mfd/mxs-lradc.c
index 73893890b50a..b2ebb5433121 100644
--- a/drivers/mfd/mxs-lradc.c
+++ b/drivers/mfd/mxs-lradc.c
@@ -137,7 +137,7 @@ static int mxs_lradc_probe(struct platform_device *pdev)
if (!lradc)
return -ENOMEM;

- lradc->soc = (enum mxs_lradc_id)device_get_match_data(&pdev->dev);
+ lradc->soc = (kernel_ulong_t)device_get_match_data(&pdev->dev);

lradc->clk = devm_clk_get(&pdev->dev, NULL);
if (IS_ERR(lradc->clk)) {
--
2.43.0


2024-06-06 15:30:11

by Krzysztof Kozlowski

[permalink] [raw]
Subject: [PATCH 3/3] mfd: wm8994: Fix Wvoid-pointer-to-enum-cast warning (again)

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

wm8994-core.c:625:17: error: cast to smaller integer type 'enum wm8994_type' from 'const void *' [-Werror,-Wvoid-pointer-to-enum-cast]

Year ago this was solved, although LKML discussion suggested warning is
not suitable for kernel. Nothing changed in this regard for a year, so
assume the warning will stay and we want to have warnings-free builds.

Link: https://lore.kernel.org/all/[email protected]/
Link: https://lore.kernel.org/all/[email protected]/
Signed-off-by: Krzysztof Kozlowski <[email protected]>
---
drivers/mfd/wm8994-core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mfd/wm8994-core.c b/drivers/mfd/wm8994-core.c
index d5ac066f9db4..094c0b3dbd97 100644
--- a/drivers/mfd/wm8994-core.c
+++ b/drivers/mfd/wm8994-core.c
@@ -622,7 +622,7 @@ static int wm8994_i2c_probe(struct i2c_client *i2c)
wm8994->dev = &i2c->dev;
wm8994->irq = i2c->irq;

- wm8994->type = (enum wm8994_type)i2c_get_match_data(i2c);
+ wm8994->type = (kernel_ulong_t)i2c_get_match_data(i2c);

wm8994->regmap = devm_regmap_init_i2c(i2c, &wm8994_base_regmap_config);
if (IS_ERR(wm8994->regmap)) {
--
2.43.0


2024-06-10 16:09:21

by Charles Keepax

[permalink] [raw]
Subject: Re: [PATCH 3/3] mfd: wm8994: Fix Wvoid-pointer-to-enum-cast warning (again)

On Thu, Jun 06, 2024 at 04:36:48PM +0200, Krzysztof Kozlowski wrote:
> 'type' is an enum, thus cast of pointer on 64-bit compile test with
> clang and W=1 causes:
>
> wm8994-core.c:625:17: error: cast to smaller integer type 'enum wm8994_type' from 'const void *' [-Werror,-Wvoid-pointer-to-enum-cast]
>
> Year ago this was solved, although LKML discussion suggested warning is
> not suitable for kernel. Nothing changed in this regard for a year, so
> assume the warning will stay and we want to have warnings-free builds.
>
> Link: https://lore.kernel.org/all/[email protected]/
> Link: https://lore.kernel.org/all/[email protected]/
> Signed-off-by: Krzysztof Kozlowski <[email protected]>
> ---

Reviewed-by: Charles Keepax <[email protected]>

Thanks,
Charles

2024-06-13 17:10:00

by Lee Jones

[permalink] [raw]
Subject: Re: [PATCH 1/3] mfd: max14577: Fix Wvoid-pointer-to-enum-cast warning (again)

On Thu, 06 Jun 2024 16:36:46 +0200, Krzysztof Kozlowski wrote:
> 'type' is an enum, thus cast of pointer on 64-bit compile test with
> clang and W=1 causes:
>
> max14577.c:400:23: error: cast to smaller integer type 'enum maxim_device_type' from 'const void *' [-Werror,-Wvoid-pointer-to-enum-cast]
>
> Year ago this was solved, although LKML discussion suggested warning is
> not suitable for kernel. Nothing changed in this regard for a year, so
> assume the warning will stay and we want to have warnings-free builds.
>
> [...]

Applied, thanks!

[1/3] mfd: max14577: Fix Wvoid-pointer-to-enum-cast warning (again)
commit: 9d1e745c2dc06fed0eb6e3b549b75669f9da77be
[2/3] mfd: mxs-lradc: Fix Wvoid-pointer-to-enum-cast warning (again)
commit: a377d89e5064e787deecfb87d9464ea18f5f067e
[3/3] mfd: wm8994: Fix Wvoid-pointer-to-enum-cast warning (again)
commit: 05bb1fb09b523136acb58421361a259127de68d4

--
Lee Jones [李琼斯]