megaraid: fix null pointer check in megasas_detach_one().
authorMaurizio Lombardi <mlombard@redhat.com>
Fri, 22 Jan 2016 12:41:42 +0000 (13:41 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 30 Sep 2016 08:18:36 +0000 (10:18 +0200)
commit 546e559c79b1a8d27c23262907a00fc209e392a0 upstream.

The pd_seq_sync pointer can't be NULL, we have to check its entries
instead.

Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
Acked-by: Sumit Saxena <sumit.saxena@broadcom.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/scsi/megaraid/megaraid_sas_base.c

index 3f8d357b1bac9f93c2128254b11a677638c105e9..278e10cd771f65eca88a87d500924e82f856de7c 100644 (file)
@@ -5941,11 +5941,11 @@ static void megasas_detach_one(struct pci_dev *pdev)
                        if (fusion->ld_drv_map[i])
                                free_pages((ulong)fusion->ld_drv_map[i],
                                        fusion->drv_map_pages);
-                               if (fusion->pd_seq_sync)
-                                       dma_free_coherent(&instance->pdev->dev,
-                                               pd_seq_map_sz,
-                                               fusion->pd_seq_sync[i],
-                                               fusion->pd_seq_phys[i]);
+                       if (fusion->pd_seq_sync[i])
+                               dma_free_coherent(&instance->pdev->dev,
+                                       pd_seq_map_sz,
+                                       fusion->pd_seq_sync[i],
+                                       fusion->pd_seq_phys[i]);
                }
                free_pages((ulong)instance->ctrl_context,
                        instance->ctrl_context_pages);