All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kernel-janitors@vger.kernel.org
Subject: [patch] nvme: lightnvm: clean up a data type
Date: Tue, 03 Nov 2015 22:37:31 +0000	[thread overview]
Message-ID: <20151103223731.GE19280@mwanda> (raw)

"nlb_pr_rq" can't be more than u32 because "len" is a u32.  Later we
truncate it to u32 anyway when we calculate min_t().

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/nvme/host/lightnvm.c b/drivers/nvme/host/lightnvm.c
index 133c839..e0b7b95 100644
--- a/drivers/nvme/host/lightnvm.c
+++ b/drivers/nvme/host/lightnvm.c
@@ -282,7 +282,7 @@ static int nvme_nvm_get_l2p_tbl(struct request_queue *q, u64 slba, u32 nlb,
 	struct nvme_dev *dev = ns->dev;
 	struct nvme_nvm_command c = {};
 	u32 len = queue_max_hw_sectors(q) << 9;
-	u64 nlb_pr_rq = len / sizeof(u64);
+	u32 nlb_pr_rq = len / sizeof(u64);
 	u64 cmd_slba = slba;
 	void *entries;
 	int ret = 0;
@@ -294,7 +294,7 @@ static int nvme_nvm_get_l2p_tbl(struct request_queue *q, u64 slba, u32 nlb,
 		return -ENOMEM;
 
 	while (nlb) {
-		u32 cmd_nlb = min_t(u32, nlb_pr_rq, nlb);
+		u32 cmd_nlb = min(nlb_pr_rq, nlb);
 
 		c.l2p.slba = cpu_to_le64(cmd_slba);
 		c.l2p.nlb = cpu_to_le32(cmd_nlb);

WARNING: multiple messages have this Message-ID (diff)
From: dan.carpenter@oracle.com (Dan Carpenter)
Subject: [patch] nvme: lightnvm: clean up a data type
Date: Wed, 4 Nov 2015 01:37:31 +0300	[thread overview]
Message-ID: <20151103223731.GE19280@mwanda> (raw)

"nlb_pr_rq" can't be more than u32 because "len" is a u32.  Later we
truncate it to u32 anyway when we calculate min_t().

Signed-off-by: Dan Carpenter <dan.carpenter at oracle.com>

diff --git a/drivers/nvme/host/lightnvm.c b/drivers/nvme/host/lightnvm.c
index 133c839..e0b7b95 100644
--- a/drivers/nvme/host/lightnvm.c
+++ b/drivers/nvme/host/lightnvm.c
@@ -282,7 +282,7 @@ static int nvme_nvm_get_l2p_tbl(struct request_queue *q, u64 slba, u32 nlb,
 	struct nvme_dev *dev = ns->dev;
 	struct nvme_nvm_command c = {};
 	u32 len = queue_max_hw_sectors(q) << 9;
-	u64 nlb_pr_rq = len / sizeof(u64);
+	u32 nlb_pr_rq = len / sizeof(u64);
 	u64 cmd_slba = slba;
 	void *entries;
 	int ret = 0;
@@ -294,7 +294,7 @@ static int nvme_nvm_get_l2p_tbl(struct request_queue *q, u64 slba, u32 nlb,
 		return -ENOMEM;
 
 	while (nlb) {
-		u32 cmd_nlb = min_t(u32, nlb_pr_rq, nlb);
+		u32 cmd_nlb = min(nlb_pr_rq, nlb);
 
 		c.l2p.slba = cpu_to_le64(cmd_slba);
 		c.l2p.nlb = cpu_to_le32(cmd_nlb);

             reply	other threads:[~2015-11-03 22:37 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-03 22:37 Dan Carpenter [this message]
2015-11-03 22:37 ` [patch] nvme: lightnvm: clean up a data type Dan Carpenter
2015-11-03 22:45 ` Busch, Keith
2015-11-03 22:45   ` Busch, Keith
2015-11-04  2:27   ` Matias Bjorling
2015-11-04  2:27     ` Matias Bjorling
2015-11-03 23:02 ` Jens Axboe
2015-11-03 23:02   ` Jens Axboe

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=20151103223731.GE19280@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=kernel-janitors@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.