Message ID | 20221017032205.2210188-4-damien.lemoal@opensource.wdc.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Fix compilation warnings | expand |
On 10/16/22 20:22, Damien Le Moal wrote: > When compiling with clang and W=1, the following warning is generated: > > drivers/ata/ahci_brcm.c:451:18: error: cast to smaller integer type > 'enum brcm_ahci_version' from 'const void *' > [-Werror,-Wvoid-pointer-to-enum-cast] > priv->version = (enum brcm_ahci_version)of_id->data; > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > Fix this by using a cast to unsigned long to match the "void *" type > size of of_id->data. > > Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com> Acked-bby: Florian Fainelli <f.fainelli@gmail.com>
diff --git a/drivers/ata/ahci_brcm.c b/drivers/ata/ahci_brcm.c index f61795c546cf..6f216eb25610 100644 --- a/drivers/ata/ahci_brcm.c +++ b/drivers/ata/ahci_brcm.c @@ -448,7 +448,7 @@ static int brcm_ahci_probe(struct platform_device *pdev) if (!of_id) return -ENODEV; - priv->version = (enum brcm_ahci_version)of_id->data; + priv->version = (unsigned long)of_id->data; priv->dev = dev; res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "top-ctrl");
When compiling with clang and W=1, the following warning is generated: drivers/ata/ahci_brcm.c:451:18: error: cast to smaller integer type 'enum brcm_ahci_version' from 'const void *' [-Werror,-Wvoid-pointer-to-enum-cast] priv->version = (enum brcm_ahci_version)of_id->data; ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Fix this by using a cast to unsigned long to match the "void *" type size of of_id->data. Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com> --- drivers/ata/ahci_brcm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)