linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: "Martin K . Petersen" <martin.petersen@oracle.com>
Cc: Christoph Hellwig <hch@lst.de>,
	linux-scsi@vger.kernel.org, Bart Van Assche <bvanassche@acm.org>,
	Benjamin Block <bblock@linux.ibm.com>,
	Douglas Gilbert <dgilbert@interlog.com>
Subject: [PATCH v3 1/4] scsi: core: Use min() instead of open-coding it
Date: Wed, 17 May 2023 16:09:24 -0700	[thread overview]
Message-ID: <20230517230927.1091124-2-bvanassche@acm.org> (raw)
In-Reply-To: <20230517230927.1091124-1-bvanassche@acm.org>

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>
---
 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)

  reply	other threads:[~2023-05-17 23:09 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-17 23:09 [PATCH v3 0/4] SCSI core patches Bart Van Assche
2023-05-17 23:09 ` Bart Van Assche [this message]
2023-05-17 23:09 ` [PATCH v3 2/4] scsi: core: Trace SCSI sense data Bart Van Assche
2023-05-18  1:00   ` Ming Lei
2023-05-18 19:22     ` Bart Van Assche
2023-05-17 23:09 ` [PATCH v3 3/4] scsi: core: Only kick the requeue list if necessary Bart Van Assche
2023-05-17 23:09 ` [PATCH v3 4/4] scsi: core: Delay running the queue if the host is blocked Bart Van Assche
2023-05-18  1:16   ` Ming Lei
2023-05-18  2:34     ` Bart Van Assche
2023-05-18  2:39       ` Ming Lei
2023-05-18 14:59         ` Bart Van Assche
2023-05-18 11:36       ` Hannes Reinecke

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230517230927.1091124-2-bvanassche@acm.org \
    --to=bvanassche@acm.org \
    --cc=bblock@linux.ibm.com \
    --cc=dgilbert@interlog.com \
    --cc=hch@lst.de \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).