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

From: wangyijing
Date: Wed Jul 12 2017 - 22:20:57 EST




å 2017/7/12 21:51, John Garry åé:
> 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.

Oh, sorry, it's a accidental change, good catch, thanks!

>
>
>
> .
>