Re: [PATCH v3 6/7] libsas: add wait-complete support to sync discovery event

From: John Garry
Date: Wed Jul 12 2017 - 09:52:47 EST


On 10/07/2017 08:06, Yijing Wang wrote:

static void sas_chain_event(int event, unsigned long *pending,
@@ -592,9 +596,9 @@ int sas_discover_event(struct asd_sas_port *port, enum discover_event ev)
{
struct sas_discovery *disc;

+ disc = &port->disc;
if (!port)
return 0;
- disc = &port->disc;

BUG_ON(ev >= DISC_NUM_EVENTS);

diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c
index 570b2cb..9d26c28 1

I was just looking through the code and I noticed this, above. Is there a specific reason to move the NULL check, or was it modified accidentally?

I mean, if port is NULL I don't think we would get as far as checking it as we would have already de-referenced it.