Skip to contentSkip to conversation

NVMe: Add persistent reservation ops

PATCH In review Keith Busch 3 participants 3 messages Nov 3, 2015 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): 20151103125815.GA5825@mwanda

#1 lore raw
Quoted 9 lines · Dan Carpenter
	drivers/nvme/host/pci.c:2143 nvme_pr_clear()
	warn: suspicious bitop condition

drivers/nvme/host/pci.c
2141 static int nvme_pr_clear(struct block_device *bdev, u64 key) 2142 {
2143 u32 cdw10 = 1 | key ? 1 << 3 : 0;

Quoted 6 lines

Is this supposed to be?

		u32 cdw10 = 1 | (key ? 1 << 3 : 0);
  2144          return nvme_pr_command(bdev, cdw10, key, 0, nvme_cmd_resv_register);
  2145  }

Thanks for the catch. Must have pulled the patch from the wrong machine when I added it to the persistent reservation series. Do you want to send the fixing patch?

#2 lore raw

PATCH 1/1 NVMe: Precedence error in nvme_pr_clear()

The original code is equivalent to:

	u32 cdw10 = (1 | key) ? 1 << 3 : 0;

But we want:

	u32 cdw10 = 1 | (key ? 1 << 3 : 0);
Fixes 1d277a637a71: ('NVMe: Add persistent reservation ops')
drivers/nvme/host/pci.c +1 -1
index 34fae28..8bcb772 100644
@@ -2140,7 +2140,7 @@ static int nvme_pr_preempt(struct block_device *bdev, u64 old, u64 new,
 
 static int nvme_pr_clear(struct block_device *bdev, u64 key)
 {
-	u32 cdw10 = 1 | key ? 1 << 3 : 0;
+	u32 cdw10 = 1 | (key ? 1 << 3 : 0);
 	return nvme_pr_command(bdev, cdw10, key, 0, nvme_cmd_resv_register);
 }
 
#3 lore raw

Re: [patch] NVMe: Precedence error in nvme_pr_clear()

Quoted 10 lines · Dan Carpenter

The original code is equivalent to:

	u32 cdw10 = (1 | key) ? 1 << 3 : 0;

But we want:

	u32 cdw10 = 1 | (key ? 1 << 3 : 0);
Fixes 1d277a637a71: ('NVMe: Add persistent reservation ops')

Thanks Dan, applied.

Signature · 1 line
Jens Axboe