ata: ahci_qoriq: Fix compilation warning
authorDamien Le Moal <damien.lemoal@opensource.wdc.com>
Fri, 14 Oct 2022 02:03:49 +0000 (11:03 +0900)
committerDamien Le Moal <damien.lemoal@opensource.wdc.com>
Mon, 17 Oct 2022 23:02:14 +0000 (08:02 +0900)
When compiling with clang and W=1, the following warning is generated:

drivers/ata/ahci_qoriq.c:283:22: error: cast to smaller integer type
'enum ahci_qoriq_type' from 'const void *'
[-Werror,-Wvoid-pointer-to-enum-cast]
                qoriq_priv->type = (enum ahci_qoriq_type)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-by: Arnd Bergmann <arnd@arndb.de>
drivers/ata/ahci_qoriq.c

index 6cd6184..9cf9bf3 100644 (file)
@@ -280,7 +280,7 @@ static int ahci_qoriq_probe(struct platform_device *pdev)
                return -ENOMEM;
 
        if (of_id)
-               qoriq_priv->type = (enum ahci_qoriq_type)of_id->data;
+               qoriq_priv->type = (unsigned long)of_id->data;
        else
                qoriq_priv->type = (enum ahci_qoriq_type)acpi_id->driver_data;