From: Bart Van Assche <bvanassche@acm.org>
To: "Martin K . Petersen" <martin.petersen@oracle.com>
Cc: Jaegeuk Kim <jaegeuk@kernel.org>,
linux-scsi@vger.kernel.org, Bart Van Assche <bvanassche@acm.org>,
Bart Van Assche <bvanassche@google.com>,
Douglas Gilbert <dgilbert@interlog.com>,
"James E.J. Bottomley" <jejb@linux.ibm.com>
Subject: [PATCH 1/4] scsi: core: Use min() instead of open-coding it
Date: Tue, 25 Apr 2023 16:34:43 -0700 [thread overview]
Message-ID: <20230425233446.1231000-2-bvanassche@acm.org> (raw)
In-Reply-To: <20230425233446.1231000-1-bvanassche@acm.org>
From: Bart Van Assche <bvanassche@google.com>
Use min() instead of open-coding it in scsi_normalize_sense().
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)
next prev parent reply other threads:[~2023-04-25 23:36 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-25 23:34 [PATCH 0/4] SCSI core patches Bart Van Assche
2023-04-25 23:34 ` Bart Van Assche [this message]
2023-04-25 23:34 ` [PATCH 2/4] scsi: core: Update a source code comment Bart Van Assche
2023-04-28 5:38 ` Christoph Hellwig
2023-04-28 16:58 ` Bart Van Assche
2023-04-25 23:34 ` [PATCH 3/4] scsi: Only kick the requeue list if necessary Bart Van Assche
2023-04-26 3:23 ` kernel test robot
2023-04-26 5:16 ` kernel test robot
2023-04-25 23:34 ` [PATCH 4/4] scsi: Trace SCSI sense data Bart Van Assche
2023-04-25 23:52 ` Steven Rostedt
2023-04-28 8:09 ` Niklas Cassel
2023-04-28 18:36 ` Bart Van Assche
2023-05-02 9:52 ` Niklas Cassel
2023-05-02 20:31 ` Bart Van Assche
2023-05-03 7:16 ` Niklas Cassel
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=20230425233446.1231000-2-bvanassche@acm.org \
--to=bvanassche@acm.org \
--cc=bvanassche@google.com \
--cc=dgilbert@interlog.com \
--cc=jaegeuk@kernel.org \
--cc=jejb@linux.ibm.com \
--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