ata: ahci_xgene: potential NULL dereference in probe
authorDan Carpenter <dan.carpenter@oracle.com>
Fri, 15 May 2015 09:24:15 +0000 (12:24 +0300)
committerTejun Heo <tj@kernel.org>
Mon, 18 May 2015 20:43:23 +0000 (16:43 -0400)
Smatch complains about this potential NULL dereference of "acpi_id".

Fixes: c9802a4be661 ('ata: ahci_xgene: Add AHCI Support for 2nd HW version of APM X-Gene SoC AHCI SATA Host controller.')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
drivers/ata/ahci_xgene.c

index 2add250d155576beebe98fff6f4ae9952ce6f199..e2c6d9e0c5ac5ce5ce389b0ae1b0597ae979ee8b 100644 (file)
@@ -732,9 +732,7 @@ static int xgene_ahci_probe(struct platform_device *pdev)
                if (!acpi_id) {
                        dev_warn(&pdev->dev, "No node entry in ACPI table. Assume version1\n");
                        version = XGENE_AHCI_V1;
-               }
-
-               if (acpi_id->driver_data) {
+               } else if (acpi_id->driver_data) {
                        version = (enum xgene_ahci_version) acpi_id->driver_data;
                        status = acpi_get_object_info(ACPI_HANDLE(&pdev->dev), &info);
                        if (ACPI_FAILURE(status)) {