summaryrefslogtreecommitdiffstats
path: root/drivers/scsi/scsi_common.c
diff options
context:
space:
mode:
authorBart Van Assche <bvanassche@acm.org>2023-05-18 21:31:57 +0200
committerMartin K. Petersen <martin.petersen@oracle.com>2023-05-31 17:05:34 +0200
commit416dace649c45fdbf7a9d62dfc060fdbee9c8bea (patch)
tree1d19b7dd8b0045486187a2ff854cc4e55910c55c /drivers/scsi/scsi_common.c
parentscsi: docs: sym53c8xx_2: Shorten chapter heading (diff)
downloadlinux-416dace649c45fdbf7a9d62dfc060fdbee9c8bea.tar.xz
linux-416dace649c45fdbf7a9d62dfc060fdbee9c8bea.zip
scsi: core: Use min() instead of open-coding it
Use min() instead of open-coding it in scsi_normalize_sense(). Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Benjamin Block <bblock@linux.ibm.com> Cc: Douglas Gilbert <dgilbert@interlog.com> Signed-off-by: Bart Van Assche <bvanassche@acm.org> Link: https://lore.kernel.org/r/20230518193159.1166304-2-bvanassche@acm.org Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/scsi_common.c')
-rw-r--r--drivers/scsi/scsi_common.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/scsi/scsi_common.c b/drivers/scsi/scsi_common.c
index b7a7a2eea887..9c14fdf61037 100644
--- a/drivers/scsi/scsi_common.c
+++ b/drivers/scsi/scsi_common.c
@@ -219,8 +219,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)