summary refs log tree commit diff
diff options
context:
space:
mode:
authorNamjae Jeon <linkinjeon@gmail.com>2012-05-20 03:08:01 -0400
committerJames Bottomley <JBottomley@Parallels.com>2012-05-23 09:29:39 +0100
commit4886b1afee5aaccc2fb3202620a5608caf0c9284 (patch)
treec8ae9c296c1a14b762dc997b8f783428c4b93149
parent841f97bffc11daaef9eb28d201be25b1509db97d (diff)
downloadlinux-4886b1afee5aaccc2fb3202620a5608caf0c9284.tar.gz
[SCSI] ufs: fix potential NULL pointer dereferencing error in ufshcd_prove.
Avoid dereferencing a NULL pointer if scsi_host_alloc is failed.

Signed-off-by: Namjae Jeon <linkinjeon@gmail.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
-rw-r--r--drivers/scsi/ufs/ufshcd.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 4e010b727818..6a4fd00117ca 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -1836,7 +1836,7 @@ ufshcd_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 	err = pci_request_regions(pdev, UFSHCD);
 	if (err < 0) {
 		dev_err(&pdev->dev, "request regions failed\n");
-		goto out_disable;
+		goto out_host_put;
 	}
 
 	hba->mmio_base = pci_ioremap_bar(pdev, 0);
@@ -1925,8 +1925,9 @@ out_iounmap:
 	iounmap(hba->mmio_base);
 out_release_regions:
 	pci_release_regions(pdev);
-out_disable:
+out_host_put:
 	scsi_host_put(host);
+out_disable:
 	pci_clear_master(pdev);
 	pci_disable_device(pdev);
 out_error: