Skip to contentSkip to conversation

scsi/qla2xxx: checking for null cleanups

PATCH New Dan Carpenter 1 participant 1 message May 22, 2010

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

PATCH 1/1 scsi/qla2xxx: checking for null cleanups

These are two cleanups to make the static checkers happy. The "vha" is used as the list cursor and can never be null so I removed the check. I also modified qla2x00_request_firmware() to avoid a theoretical null dereference. This is unlikely to happen I think, but it makes auditing easier.

drivers/scsi/qla2xxx/qla_os.c +3 -1
index be1a8fc..d306853 100644
@@ -2354,7 +2354,7 @@ qla2x00_remove_one(struct pci_dev *pdev)
 	ha = base_vha->hw;
 
 	list_for_each_entry_safe(vha, temp, &ha->vp_list, list) {
-		if (vha && vha->fc_vport)
+		if (vha->fc_vport)
 			fc_vport_terminate(vha->fc_vport);
 	}
 
@@ -3689,6 +3689,8 @@ qla2x00_request_firmware(scsi_qla_host_t *vha)
 		blob = &qla_fw_blobs[FW_ISP81XX];
 	} else if (IS_QLA82XX(ha)) {
 		blob = &qla_fw_blobs[FW_ISP82XX];
+	} else {
+		return NULL;
 	}
 
 	mutex_lock(&qla_fw_lock);