On Wed, 2018-02-21 at 20:48 -0500, Douglas Gilbert wrote:
> +     if (result) {
> +             if (sense_valid && (sshdr.sense_key == RECOVERED_ERROR)) {
> +                     /* if ATA PASS-THROUGH INFORMATION AVAILABLE skip
> +                      * print since caller wants ATA registers. Only occurs
> +                      * on SCSI ATA PASS_THROUGH commands when CK_COND=1
> +                      */
> +                     if ((sshdr.asc == 0x0) && (sshdr.ascq == 0x1d))
> +                             ;
> +                     else if (!(req->rq_flags & RQF_QUIET))
> +                             scsi_print_sense(cmd);
> +                     result = 0;
> +                     /* for passthrough error may be set */
> +                     error = BLK_STS_OK;
> +     /*
> +      * Another corner case: the SCSI status byte is non-zero but 'good'.
> +      * Example: PRE-FETCH command returns SAM_STAT_CONDITION_MET when
> +      * it is able to fit nominated LBs in its cache (and SAM_STAT_GOOD
> +      * if it can't fit). Treat SAM_STAT_CONDITION_MET and the related
> +      * intermediate statuses (both obsolete in SAM-4) as good.
> +      */
> +             } else if (status_byte(result) &&
> +                        scsi_status_is_good(result)) {
> +                     result = 0;
> +                     /* for passthrough error may be set */
> +                     error = BLK_STS_OK;
> +             }
>       }

Please move the new comment block under "} else if" and indent it further to
the right such that neither gcc with W=1 nor smatch complain about incorrect
indentation.

Please also change the branching logic as follows to keep the indentation level
low:

        if (sense_valid && (sshdr.sense_key == RECOVERED_ERROR)) {
                [ ... ]
        } else if (status_byte(result) && scsi_status_is_good(result)) {
                [ ... ]
        }

Thanks,

Bart.


Reply via email to