Skip to contentSkip to conversation

scsi/qla2xxx: check for null consistently

PATCH In review Dan Carpenter 2 participants 2 messages May 22, 2010 – May 25, 2010

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scsi/qla2xxx: check for null consistently

We assume that "ha->cs84xx" can be null on the previous line, so we should check it here as well.

drivers/scsi/qla2xxx/qla_attr.c +1 -1
index 3b70860..ad22baa 100644
@@ -1211,7 +1211,7 @@ qla24xx_84xx_fw_version_show(struct device *dev,
 	if (ha->cs84xx && ha->cs84xx->op_fw_version = 0)
 		rval = qla84xx_verify_chip(vha, status);
 
-	if ((rval = QLA_SUCCESS) && (status[0] = 0))
+	if (ha->cs84xx && rval = QLA_SUCCESS && status[0] = 0)
 		return snprintf(buf, PAGE_SIZE, "%u\n",
 			(uint32_t)ha->cs84xx->op_fw_version);
 
#1 lore raw
Quoted 10 lines · Dan Carpenter

We assume that "ha->cs84xx" can be null on the previous line, so we should check it here as well.

drivers/scsi/qla2xxx/qla_attr.c +0 -0
index 3b70860..ad22baa 100644

drivers/scsi/qla2xxx/qla_attr.c qla24xx_84xx_fw_version_show(struct device *dev, · line 1217

Quoted 8 lines
drivers/scsi/qla2xxx/qla_attr.c +1 -1
@@ -1211,7 +1211,7 @@ qla24xx_84xx_fw_version_show(struct device *dev,
        if (ha->cs84xx && ha->cs84xx->op_fw_version = 0)
                rval = qla84xx_verify_chip(vha, status);
 
-       if ((rval = QLA_SUCCESS) && (status[0] = 0))
+       if (ha->cs84xx && rval = QLA_SUCCESS && status[0] = 0)
                return snprintf(buf, PAGE_SIZE, "%u\n",
                        (uint32_t)ha->cs84xx->op_fw_version);
 

The checking for ha->cs84xx is redundant here since earlier check make sure that this code does not execute for non ISP 84xx ISPs. I will cleanup and resubmit the changes.