[PATCH 2/6] ata: sata_rcar: Fix compilation warning

Geert Uytterhoeven geert at linux-m68k.org
Mon Oct 17 00:13:09 PDT 2022


Hi Damien,

On Mon, Oct 17, 2022 at 5:22 AM Damien Le Moal
<damien.lemoal at opensource.wdc.com> wrote:
> When compiling with clang and W=1, the following warning is generated:
>
> drivers/ata/sata_rcar.c:878:15: error: cast to smaller integer type
> 'enum sata_rcar_type' from 'const void *'
> [-Werror,-Wvoid-pointer-to-enum-cast]
>         priv->type = (enum sata_rcar_type)of_device_get_match_data(dev);
>                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> Fix this by using a cast to unsigned long to match the "void *" type
> size returned by of_device_get_match_data().
>
> Signed-off-by: Damien Le Moal <damien.lemoal at opensource.wdc.com>

Reviewed-by: Geert Uytterhoeven <geert+renesas at glider.be>

Modulo bike-shedding about "uintptr_t" vs. "unsigned long".
I'd prefer the former (the road to Zettalinux?), but Linus prefers the latter.

> --- a/drivers/ata/sata_rcar.c
> +++ b/drivers/ata/sata_rcar.c
> @@ -875,7 +875,7 @@ static int sata_rcar_probe(struct platform_device *pdev)
>         if (!priv)
>                 return -ENOMEM;
>
> -       priv->type = (enum sata_rcar_type)of_device_get_match_data(dev);
> +       priv->type = (unsigned long)of_device_get_match_data(dev);
>
>         pm_runtime_enable(dev);
>         ret = pm_runtime_get_sync(dev);

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds



More information about the linux-arm-kernel mailing list