diff mbox series

gpio: mxs: fix Wvoid-pointer-to-enum-cast warning

Message ID 20230810095949.123473-1-krzysztof.kozlowski@linaro.org
State New
Headers show
Series gpio: mxs: fix Wvoid-pointer-to-enum-cast warning | expand

Commit Message

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

  gpio-mxs.c:274:16: error: cast to smaller integer type 'enum mxs_gpio_id' from 'const void *' [-Werror,-Wvoid-pointer-to-enum-cast]

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

Comments

Andy Shevchenko Aug. 10, 2023, 10:19 a.m. UTC | #1
On Thu, Aug 10, 2023 at 12:59 PM Krzysztof Kozlowski
<krzysztof.kozlowski@linaro.org> wrote:
>
> 'devid' is an enum, thus cast of pointer on 64-bit compile test with W=1
> causes:
>
>   gpio-mxs.c:274:16: error: cast to smaller integer type 'enum mxs_gpio_id' from 'const void *' [-Werror,-Wvoid-pointer-to-enum-cast]

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Bartosz Golaszewski Aug. 11, 2023, 2:22 p.m. UTC | #2
On Thu, Aug 10, 2023 at 11:59 AM Krzysztof Kozlowski
<krzysztof.kozlowski@linaro.org> wrote:
>
> 'devid' is an enum, thus cast of pointer on 64-bit compile test with W=1
> causes:
>
>   gpio-mxs.c:274:16: error: cast to smaller integer type 'enum mxs_gpio_id' from 'const void *' [-Werror,-Wvoid-pointer-to-enum-cast]
>
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> ---
>  drivers/gpio/gpio-mxs.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpio/gpio-mxs.c b/drivers/gpio/gpio-mxs.c
> index 8e04c9c4b5a2..024ad077e98d 100644
> --- a/drivers/gpio/gpio-mxs.c
> +++ b/drivers/gpio/gpio-mxs.c
> @@ -271,7 +271,7 @@ static int mxs_gpio_probe(struct platform_device *pdev)
>         port->id = of_alias_get_id(np, "gpio");
>         if (port->id < 0)
>                 return port->id;
> -       port->devid = (enum mxs_gpio_id)of_device_get_match_data(&pdev->dev);
> +       port->devid = (uintptr_t)of_device_get_match_data(&pdev->dev);
>         port->dev = &pdev->dev;
>         port->irq = platform_get_irq(pdev, 0);
>         if (port->irq < 0)
> --
> 2.34.1
>

Applied, thanks!

Bart
diff mbox series

Patch

diff --git a/drivers/gpio/gpio-mxs.c b/drivers/gpio/gpio-mxs.c
index 8e04c9c4b5a2..024ad077e98d 100644
--- a/drivers/gpio/gpio-mxs.c
+++ b/drivers/gpio/gpio-mxs.c
@@ -271,7 +271,7 @@  static int mxs_gpio_probe(struct platform_device *pdev)
 	port->id = of_alias_get_id(np, "gpio");
 	if (port->id < 0)
 		return port->id;
-	port->devid = (enum mxs_gpio_id)of_device_get_match_data(&pdev->dev);
+	port->devid = (uintptr_t)of_device_get_match_data(&pdev->dev);
 	port->dev = &pdev->dev;
 	port->irq = platform_get_irq(pdev, 0);
 	if (port->irq < 0)