linux-nvme.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] Address issues reported by static checkers
@ 2016-06-20  6:11 Bart Van Assche
  2016-06-20  6:12 ` [PATCH 1/2] nvme: Remove set-but-not-used variables Bart Van Assche
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Bart Van Assche @ 2016-06-20  6:11 UTC (permalink / raw)


Hello Keith,

The two patches in this series address warning messages reported by 
static source code analysis tool (gcc + W=1, smatch and checkpatch). It 
would be appreciated if you could have a look at these two patches.

Thanks,

Bart.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/2] nvme: Remove set-but-not-used variables
  2016-06-20  6:11 [PATCH 0/2] Address issues reported by static checkers Bart Van Assche
@ 2016-06-20  6:12 ` Bart Van Assche
  2016-06-20  6:39   ` Sagi Grimberg
  2016-06-20  6:13 ` [PATCH 2/2] nvme: Make indentation consistent Bart Van Assche
  2016-06-20 15:06 ` [PATCH 0/2] Address issues reported by static checkers Keith Busch
  2 siblings, 1 reply; 6+ messages in thread
From: Bart Van Assche @ 2016-06-20  6:12 UTC (permalink / raw)


Detected these variables by building with W=1.

Signed-off-by: Bart Van Assche <bart.vanassche at sandisk.com>
Cc: Jens Axboe <axboe at fb.com>
Cc: Christoph Hellwig <hch at lst.de>
Cc: Sagi Grimberg <sagig at grimberg.me>
---
 drivers/nvme/host/scsi.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/nvme/host/scsi.c b/drivers/nvme/host/scsi.c
index e947e29..0fd9707 100644
--- a/drivers/nvme/host/scsi.c
+++ b/drivers/nvme/host/scsi.c
@@ -1347,10 +1347,6 @@ static inline void nvme_trans_modesel_get_bd_len(u8 *parm_list, u8 cdb10,
 static void nvme_trans_modesel_save_bd(struct nvme_ns *ns, u8 *parm_list,
 					u16 idx, u16 bd_len, u8 llbaa)
 {
-	u16 bd_num;
-
-	bd_num = bd_len / ((llbaa == 0) ?
-			SHORT_DESC_BLOCK : LONG_DESC_BLOCK);
 	/* Store block descriptor info if a FORMAT UNIT comes later */
 	/* TODO Saving 1st BD info; what to do if multiple BD received? */
 	if (llbaa == 0) {
@@ -1595,7 +1591,7 @@ static int nvme_trans_fmt_send_cmd(struct nvme_ns *ns, struct sg_io_hdr *hdr,
 	int nvme_sc;
 	struct nvme_id_ns *id_ns;
 	u8 i;
-	u8 flbas, nlbaf;
+	u8 nlbaf;
 	u8 selected_lbaf = 0xFF;
 	u32 cdw10 = 0;
 	struct nvme_command c;
@@ -1606,7 +1602,6 @@ static int nvme_trans_fmt_send_cmd(struct nvme_ns *ns, struct sg_io_hdr *hdr,
 	if (res)
 		return res;
 
-	flbas = (id_ns->flbas) & 0x0F;
 	nlbaf = id_ns->nlbaf;
 
 	for (i = 0; i < nlbaf; i++) {
-- 
2.8.4

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] nvme: Make indentation consistent
  2016-06-20  6:11 [PATCH 0/2] Address issues reported by static checkers Bart Van Assche
  2016-06-20  6:12 ` [PATCH 1/2] nvme: Remove set-but-not-used variables Bart Van Assche
@ 2016-06-20  6:13 ` Bart Van Assche
  2016-06-20  6:40   ` Sagi Grimberg
  2016-06-20 15:06 ` [PATCH 0/2] Address issues reported by static checkers Keith Busch
  2 siblings, 1 reply; 6+ messages in thread
From: Bart Van Assche @ 2016-06-20  6:13 UTC (permalink / raw)


This patch avoids that smatch complains about inconsistent indentation
and also that checkpatch complains about trailing whitespace. This patch
does not change any functionality.

Signed-off-by: Bart Van Assche <bart.vanassche at sandisk.com>
Cc: Jens Axboe <axboe at fb.com>
Cc: Christoph Hellwig <hch at lst.de>
Cc: Sagi Grimberg <sagig at grimberg.me>
---
 drivers/nvme/host/pci.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index befac5b..20b5c5c 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -49,7 +49,7 @@
 #define NVME_AQ_DEPTH		256
 #define SQ_SIZE(depth)		(depth * sizeof(struct nvme_command))
 #define CQ_SIZE(depth)		(depth * sizeof(struct nvme_completion))
-		
+
 /*
  * We handle AEN commands ourselves and don't even let the
  * block layer know about them.
@@ -1927,10 +1927,11 @@ static int nvme_dev_map(struct nvme_dev *dev)
 	if (!dev->bar)
 		goto release;
 
-       return 0;
-  release:
-       pci_release_selected_regions(pdev, bars);
-       return -ENODEV;
+	return 0;
+
+release:
+	pci_release_selected_regions(pdev, bars);
+	return -ENODEV;
 }
 
 static int nvme_probe(struct pci_dev *pdev, const struct pci_device_id *id)
-- 
2.8.4

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 1/2] nvme: Remove set-but-not-used variables
  2016-06-20  6:12 ` [PATCH 1/2] nvme: Remove set-but-not-used variables Bart Van Assche
@ 2016-06-20  6:39   ` Sagi Grimberg
  0 siblings, 0 replies; 6+ messages in thread
From: Sagi Grimberg @ 2016-06-20  6:39 UTC (permalink / raw)


Looks good,

Reviewed-by: Sagi Grimberg <sagi at grimberg.me>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 2/2] nvme: Make indentation consistent
  2016-06-20  6:13 ` [PATCH 2/2] nvme: Make indentation consistent Bart Van Assche
@ 2016-06-20  6:40   ` Sagi Grimberg
  0 siblings, 0 replies; 6+ messages in thread
From: Sagi Grimberg @ 2016-06-20  6:40 UTC (permalink / raw)


Looks good,

Reviewed-by: Sagi Grimberg <sagi at grimberg.me>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 0/2] Address issues reported by static checkers
  2016-06-20  6:11 [PATCH 0/2] Address issues reported by static checkers Bart Van Assche
  2016-06-20  6:12 ` [PATCH 1/2] nvme: Remove set-but-not-used variables Bart Van Assche
  2016-06-20  6:13 ` [PATCH 2/2] nvme: Make indentation consistent Bart Van Assche
@ 2016-06-20 15:06 ` Keith Busch
  2 siblings, 0 replies; 6+ messages in thread
From: Keith Busch @ 2016-06-20 15:06 UTC (permalink / raw)


On Mon, Jun 20, 2016@08:11:30AM +0200, Bart Van Assche wrote:
> Hello Keith,
> 
> The two patches in this series address warning messages reported by static
> source code analysis tool (gcc + W=1, smatch and checkpatch). It would be
> appreciated if you could have a look at these two patches.

Thanks for the fixes, looks good.

Reviewed-by: Keith Busch <keith.busch at intel.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-06-20 15:06 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-20  6:11 [PATCH 0/2] Address issues reported by static checkers Bart Van Assche
2016-06-20  6:12 ` [PATCH 1/2] nvme: Remove set-but-not-used variables Bart Van Assche
2016-06-20  6:39   ` Sagi Grimberg
2016-06-20  6:13 ` [PATCH 2/2] nvme: Make indentation consistent Bart Van Assche
2016-06-20  6:40   ` Sagi Grimberg
2016-06-20 15:06 ` [PATCH 0/2] Address issues reported by static checkers Keith Busch

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