On Wed, May 03, 2023 at 04:06:50PM -0700, Bart Van Assche wrote: > Use min() instead of open-coding it in scsi_normalize_sense(). > > Cc: Douglas Gilbert <dgilbert@xxxxxxxxxxxx> > Signed-off-by: Bart Van Assche <bvanassche@xxxxxxx> > --- > drivers/scsi/scsi_common.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/drivers/scsi/scsi_common.c b/drivers/scsi/scsi_common.c > index 6e50e81a8216..24dec80a6253 100644 > --- a/drivers/scsi/scsi_common.c > +++ b/drivers/scsi/scsi_common.c > @@ -176,8 +176,7 @@ bool scsi_normalize_sense(const u8 *sense_buffer, int sb_len, > if (sb_len > 2) > sshdr->sense_key = (sense_buffer[2] & 0xf); > if (sb_len > 7) { > - sb_len = (sb_len < (sense_buffer[7] + 8)) ? > - sb_len : (sense_buffer[7] + 8); > + sb_len = min(sb_len, sense_buffer[7] + 8); > if (sb_len > 12) > sshdr->asc = sense_buffer[12]; > if (sb_len > 13) Looks good to me. Reviewed-by: Benjamin Block <bblock@xxxxxxxxxxxxx> -- Best Regards, Benjamin Block / Linux on IBM Z Kernel Development IBM Deutschland Research & Development GmbH / https://www.ibm.com/privacy Vors. Aufs.-R.: Gregor Pillen / Geschäftsführung: David Faller Sitz der Ges.: Böblingen / Registergericht: AmtsG Stuttgart, HRB 243294