2023-08-10 09:16:26

by Krzysztof Kozlowski

[permalink] [raw]
Subject: [PATCH net-next 2/2] wifi: ath10k: fix Wvoid-pointer-to-enum-cast warning

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

ath10k/ahb.c:736:11: error: cast to smaller integer type 'enum ath10k_hw_rev' from 'const void *' [-Werror,-Wvoid-pointer-to-enum-cast]

Signed-off-by: Krzysztof Kozlowski <[email protected]>
---
drivers/net/wireless/ath/ath10k/ahb.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/ahb.c b/drivers/net/wireless/ath/ath10k/ahb.c
index 4a006fb4d424..95bcf54ddc3f 100644
--- a/drivers/net/wireless/ath/ath10k/ahb.c
+++ b/drivers/net/wireless/ath/ath10k/ahb.c
@@ -733,7 +733,7 @@ static int ath10k_ahb_probe(struct platform_device *pdev)
int ret;
struct ath10k_bus_params bus_params = {};

- hw_rev = (enum ath10k_hw_rev)of_device_get_match_data(&pdev->dev);
+ hw_rev = (uintptr_t)of_device_get_match_data(&pdev->dev);
if (!hw_rev) {
dev_err(&pdev->dev, "OF data missing\n");
return -EINVAL;
--
2.34.1



2023-08-10 14:01:19

by Jeff Johnson

[permalink] [raw]
Subject: Re: [PATCH net-next 2/2] wifi: ath10k: fix Wvoid-pointer-to-enum-cast warning

On 8/10/2023 2:12 AM, Krzysztof Kozlowski wrote:
> 'hw_rev' is an enum, thus cast of pointer on 64-bit compile test with W=1
> causes:
>
> ath10k/ahb.c:736:11: error: cast to smaller integer type 'enum ath10k_hw_rev' from 'const void *' [-Werror,-Wvoid-pointer-to-enum-cast]
>
> Signed-off-by: Krzysztof Kozlowski <[email protected]>

Acked-by: Jeff Johnson <[email protected]>

> ---
> drivers/net/wireless/ath/ath10k/ahb.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/ath/ath10k/ahb.c b/drivers/net/wireless/ath/ath10k/ahb.c
> index 4a006fb4d424..95bcf54ddc3f 100644
> --- a/drivers/net/wireless/ath/ath10k/ahb.c
> +++ b/drivers/net/wireless/ath/ath10k/ahb.c
> @@ -733,7 +733,7 @@ static int ath10k_ahb_probe(struct platform_device *pdev)
> int ret;
> struct ath10k_bus_params bus_params = {};
>
> - hw_rev = (enum ath10k_hw_rev)of_device_get_match_data(&pdev->dev);
> + hw_rev = (uintptr_t)of_device_get_match_data(&pdev->dev);
> if (!hw_rev) {
> dev_err(&pdev->dev, "OF data missing\n");
> return -EINVAL;