From: Thierry Reding <thierry.reding@gmail.com>
To: Mark Brown <broonie@kernel.org>
Cc: linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 2/2] spi: Prevent a type mismatch warning using min_t()
Date: Thu, 18 Feb 2016 14:32:58 +0100 [thread overview]
Message-ID: <1455802378-17780-2-git-send-email-thierry.reding@gmail.com> (raw)
In-Reply-To: <1455802378-17780-1-git-send-email-thierry.reding@gmail.com>
From: Thierry Reding <treding@nvidia.com>
The min_t() variant of the min() macro uses an explicit cast to the type
given in the first argument and can be used to avoid a compiler warning
if both types differ (f.e. in signedness).
Signed-off-by: Thierry Reding <treding@nvidia.com>
---
drivers/spi/spi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index f123f9f4d779..fe001ec4471e 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -2301,7 +2301,7 @@ static int __spi_split_transfer_maxsize(struct spi_master *master,
/* the first transfer just needs the length modified, so we
* run it outside the loop
*/
- xfers[0].len = min(maxsize, xfer[0].len);
+ xfers[0].len = min_t(size_t, maxsize, xfer[0].len);
/* all the others need rx_buf/tx_buf also set */
for (i = 1, offset = maxsize; i < count; offset += maxsize, i++) {
--
2.7.1
next prev parent reply other threads:[~2016-02-18 13:32 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-18 13:32 [PATCH 1/2] spi: Use %u for unsigned int, %zu for size_t Thierry Reding
2016-02-18 13:32 ` Thierry Reding [this message]
2016-02-18 13:36 ` Mark Brown
[not found] ` <20160218133619.GB7129-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2016-02-18 13:58 ` Thierry Reding
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=1455802378-17780-2-git-send-email-thierry.reding@gmail.com \
--to=thierry.reding@gmail.com \
--cc=broonie@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
/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).