[SCSI] pm8001:fix potential NULL pointer dereference
authorjack wang <jack_wang@usish.com>
Mon, 7 Dec 2009 09:22:55 +0000 (17:22 +0800)
committerJames Bottomley <James.Bottomley@suse.de>
Thu, 10 Dec 2009 16:05:25 +0000 (10:05 -0600)
Signed-off-by: Jack Wang <jack_wang@usish.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
drivers/scsi/pm8001/pm8001_sas.c

index 49721c886c26fb93a7fe41509d8d797252985fd2..487f78ff750b897c618c8d696102f46ef90e60ac 100644 (file)
@@ -616,11 +616,11 @@ static int pm8001_dev_found_notify(struct domain_device *dev)
        spin_lock_irqsave(&pm8001_ha->lock, flags);
 
        pm8001_device = pm8001_alloc_dev(pm8001_ha);
-       pm8001_device->sas_device = dev;
        if (!pm8001_device) {
                res = -1;
                goto found_out;
        }
+       pm8001_device->sas_device = dev;
        dev->lldd_dev = pm8001_device;
        pm8001_device->dev_type = dev->dev_type;
        pm8001_device->dcompletion = &completion;