scsi/qla2xxx: check for null consistently
Subsystems (3)
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.
Signed-off-by Dan Carpenter <[email protected]>
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);
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.Signed-off-by Dan Carpenter <[email protected]>drivers/scsi/qla2xxx/qla_attr.c +0
-0
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.