RE: [PATCH] mpt2sas: Fix &&/|| confusion in_scsih_sas_device_status_change_event()

From: Moore, Eric
Date: Tue Jan 12 2010 - 19:24:10 EST

Yes your patch will work. I just have tested it by sending INTERNAL_DEVICE_RESETS events, and the code is getting executed.


-----Original Message-----
From: Andrew Morton [mailto:akpm@xxxxxxxxxxxxxxxxxxxx]
Sent: Tuesday, January 12, 2010 2:54 PM
To: roel kluin
Cc: Moore, Eric; James E.J. Bottomley; linux-scsi@xxxxxxxxxxxxxxx; LKML; Desai, Kashyap
Subject: Re: [PATCH] mpt2sas: Fix &&/|| confusion in _scsih_sas_device_status_change_event()

On Thu, 7 Jan 2010 20:58:10 +0100
roel kluin <roel.kluin@xxxxxxxxx> wrote:

> On Thu, Jan 7, 2010 at 8:31 PM, Moore, Eric <Eric.Moore@xxxxxxx> wrote:
> > nack
> >
> > The code beyond this check is intended for either INTERNAL_DEVICE_RESET or CMP_DEVICE_RESET. __ If the reason code is something else, we will want to return. __There are 10 other types of reason codes besides these two. This proposed patch means we return only when the reason code is either INTERNAL_DEVICE_RESET or CMP_INTERNAL_RESET.
> >
> > Eric Moore
> my patch is correct but my changelog was wrong. Sorry for the
> confusion. It should have been:
> Even if the ReasonCode is not INTERNAL_DEVICE_RESET nor CMP_DEVICE_RESET
> this still evaluates to true.

yup, the current code is wrong.

if (!(event_data->ReasonCode ==
event_data->ReasonCode ==

ReasonCode cannot equal two different things at the same time.

This is what we want:

if (event_data->ReasonCode !=
event_data->ReasonCode !=

Eric, the fix needs runtime testing please - it enables code which
hasn't been executed in a long time, if ever.

In fact the compiler wasn't even emitting any code for the second half
of _scsih_sas_device_status_change_event() because it worked out that
there was no path to it.

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at