Re: [PATCH 2/3] scsi: check for equality of result byte values

From: Bart Van Assche
Date: Tue Jun 12 2018 - 11:12:08 EST


On Tue, 2018-06-12 at 15:53 +0200, Johannes Thumshirn wrote:
> - || status_byte(cmd->result) &
> + || status_byte(cmd->result) ==
> CHECK_CONDITION)) {

Is "status_byte(cmd->result) == CHECK_CONDITION" short enough for a single
line of code? Is the line splitting really necessary?

> - if (!(driver_byte(result) & DRIVER_SENSE) ||
> + if (!(driver_byte(result) == DRIVER_SENSE) ||

Please change (!(x == y)) into (x != y).

> - if ((driver_byte(result) & DRIVER_SENSE) &&
> + if ((driver_byte(result) == DRIVER_SENSE) &&

Please change (driver_byte(result) == DRIVER_SENSE) into
driver_byte(result) == DRIVER_SENSE.

> - ((driver_byte(the_result) & DRIVER_SENSE) &&
> + ((driver_byte(the_result) == DRIVER_SENSE) &&

Same comment here.

> - if ((driver_byte(the_result) & DRIVER_SENSE) == 0) {
> + if ((driver_byte(the_result) == DRIVER_SENSE) == 0) {

Please change (x == y) == 0 into x != y.

Thanks,

Bart.