list_for_each_entry() never leaves the iterator pointing to null.
Signed-off-by: Joe Carnuccio <joe.carnuccio@qlogic.com>
Signed-off-by: Saurav Kashyap <saurav.kashyap@qlogic.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
        int rval = 0;
        struct qla_port_param *port_param = NULL;
        fc_port_t *fcport = NULL;
+       int found = 0;
        uint16_t mb[MAILBOX_REGISTER_COUNT];
        uint8_t *rsp_ptr = NULL;
 
                if (memcmp(port_param->fc_scsi_addr.dest_addr.wwpn,
                        fcport->port_name, sizeof(fcport->port_name)))
                        continue;
+
+               found = 1;
                break;
        }
 
-       if (!fcport) {
+       if (!found) {
                ql_log(ql_log_warn, vha, 0x7049,
                    "Failed to find port.\n");
                return -EINVAL;