[net-next] phy: amlogic: meson-g12a-usb2: fix Wvoid-pointer-to-enum-cast warning

Message ID 20230810091310.70231-1-krzysztof.kozlowski@linaro.org
State New
Headers
Series [net-next] phy: amlogic: meson-g12a-usb2: fix Wvoid-pointer-to-enum-cast warning |

Commit Message

Krzysztof Kozlowski Aug. 10, 2023, 9:13 a.m. UTC
  'soc_id' is an enum, thus cast of pointer on 64-bit compile test with
W=1 causes:

  phy-meson-g12a-usb2.c:322:17: error: cast to smaller integer type 'enum meson_soc_id' from 'const void *' [-Werror,-Wvoid-pointer-to-enum-cast]

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
---
 drivers/phy/amlogic/phy-meson-g12a-usb2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Neil Armstrong Aug. 14, 2023, 7:43 a.m. UTC | #1
On 10/08/2023 11:13, Krzysztof Kozlowski wrote:
> 'soc_id' is an enum, thus cast of pointer on 64-bit compile test with
> W=1 causes:
> 
>    phy-meson-g12a-usb2.c:322:17: error: cast to smaller integer type 'enum meson_soc_id' from 'const void *' [-Werror,-Wvoid-pointer-to-enum-cast]
> 
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> ---
>   drivers/phy/amlogic/phy-meson-g12a-usb2.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/phy/amlogic/phy-meson-g12a-usb2.c b/drivers/phy/amlogic/phy-meson-g12a-usb2.c
> index a628c59e5cf0..0e0b5c00b676 100644
> --- a/drivers/phy/amlogic/phy-meson-g12a-usb2.c
> +++ b/drivers/phy/amlogic/phy-meson-g12a-usb2.c
> @@ -319,7 +319,7 @@ static int phy_meson_g12a_usb2_probe(struct platform_device *pdev)
>   	if (IS_ERR(base))
>   		return PTR_ERR(base);
>   
> -	priv->soc_id = (enum meson_soc_id)of_device_get_match_data(&pdev->dev);
> +	priv->soc_id = (uintptr_t)of_device_get_match_data(&pdev->dev);
>   
>   	priv->regmap = devm_regmap_init_mmio(dev, base,
>   					     &phy_meson_g12a_usb2_regmap_conf);

I believe the net-next is wrong here, but whatever:

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
  
Krzysztof Kozlowski Aug. 14, 2023, 7:45 a.m. UTC | #2
On 14/08/2023 09:43, Neil Armstrong wrote:
> On 10/08/2023 11:13, Krzysztof Kozlowski wrote:
>> 'soc_id' is an enum, thus cast of pointer on 64-bit compile test with
>> W=1 causes:
>>
>>    phy-meson-g12a-usb2.c:322:17: error: cast to smaller integer type 'enum meson_soc_id' from 'const void *' [-Werror,-Wvoid-pointer-to-enum-cast]
>>
>> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
>> ---
>>   drivers/phy/amlogic/phy-meson-g12a-usb2.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/phy/amlogic/phy-meson-g12a-usb2.c b/drivers/phy/amlogic/phy-meson-g12a-usb2.c
>> index a628c59e5cf0..0e0b5c00b676 100644
>> --- a/drivers/phy/amlogic/phy-meson-g12a-usb2.c
>> +++ b/drivers/phy/amlogic/phy-meson-g12a-usb2.c
>> @@ -319,7 +319,7 @@ static int phy_meson_g12a_usb2_probe(struct platform_device *pdev)
>>   	if (IS_ERR(base))
>>   		return PTR_ERR(base);
>>   
>> -	priv->soc_id = (enum meson_soc_id)of_device_get_match_data(&pdev->dev);
>> +	priv->soc_id = (uintptr_t)of_device_get_match_data(&pdev->dev);
>>   
>>   	priv->regmap = devm_regmap_init_mmio(dev, base,
>>   					     &phy_meson_g12a_usb2_regmap_conf);
> 
> I believe the net-next is wrong here, but whatever:

Yes, it's a history-copy-paste mistake.

> 
> Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>

Thanks.

Best regards,
Krzysztof
  

Patch

diff --git a/drivers/phy/amlogic/phy-meson-g12a-usb2.c b/drivers/phy/amlogic/phy-meson-g12a-usb2.c
index a628c59e5cf0..0e0b5c00b676 100644
--- a/drivers/phy/amlogic/phy-meson-g12a-usb2.c
+++ b/drivers/phy/amlogic/phy-meson-g12a-usb2.c
@@ -319,7 +319,7 @@  static int phy_meson_g12a_usb2_probe(struct platform_device *pdev)
 	if (IS_ERR(base))
 		return PTR_ERR(base);
 
-	priv->soc_id = (enum meson_soc_id)of_device_get_match_data(&pdev->dev);
+	priv->soc_id = (uintptr_t)of_device_get_match_data(&pdev->dev);
 
 	priv->regmap = devm_regmap_init_mmio(dev, base,
 					     &phy_meson_g12a_usb2_regmap_conf);