[SCSI] mpt2sas: Check for NULL pointer before free_pages is added.
Added check before free_pages just to make sure ioc->scsi_lookup is not NULL.
Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.c b/drivers/scsi/mpt2sas/mpt2sas_base.c
index b04ccad..b830d61 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_base.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_base.c
@@ -1919,7 +1919,10 @@
ioc->config_page, ioc->config_page_dma);
}
- free_pages((ulong)ioc->scsi_lookup, ioc->scsi_lookup_pages);
+ if (ioc->scsi_lookup) {
+ free_pages((ulong)ioc->scsi_lookup, ioc->scsi_lookup_pages);
+ ioc->scsi_lookup = NULL;
+ }
kfree(ioc->hpr_lookup);
kfree(ioc->internal_lookup);
}