From: Chris Leech Date: Fri, 21 Oct 2016 21:10:53 +0000 (-0700) Subject: scsi: libfc: Don't have fc_exch_find log errors on a new exchange X-Git-Tag: v4.10-rc1~128^2~137 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=d5c3eb26d9ad78a2705ec675dd2399e985c5ee52;p=karo-tx-linux.git scsi: libfc: Don't have fc_exch_find log errors on a new exchange With the error message I added in "libfc: sanity check cpu number extracted from xid" I didn't account for the fact that fc_exch_find is called with FC_XID_UNKNOWN at the start of a new exchange if we are the responder. It doesn't come up with the initiator much, but that's basically every exchange for a target. By checking the xid for FC_XID_UNKNOWN first, we not only prevent the erroneous error message, but skip the unnecessary lookup attempt as well. [mkp: applied by hand due to conflict with Hannes' libfc patch series] Signed-off-by: Chris Leech Reviewed-by: Ewan D. Milne Reviewed-by: Hannes Reinecke Signed-off-by: Martin K. Petersen --- diff --git a/drivers/scsi/libfc/fc_exch.c b/drivers/scsi/libfc/fc_exch.c index 442a6c1d5efc..42bcf7f3a0f9 100644 --- a/drivers/scsi/libfc/fc_exch.c +++ b/drivers/scsi/libfc/fc_exch.c @@ -939,6 +939,9 @@ static struct fc_exch *fc_exch_find(struct fc_exch_mgr *mp, u16 xid) struct fc_exch *ep = NULL; u16 cpu = xid & fc_cpu_mask; + if (xid == FC_XID_UNKNOWN) + return NULL; + if (cpu >= nr_cpu_ids || !cpu_possible(cpu)) { pr_err("host%u: lport %6.6x: xid %d invalid CPU %d\n:", lport->host->host_no, lport->port_id, xid, cpu);