NVMe: Add persistent reservation ops
Subsystems (2)
A message that is not in the archive (sent off-list or not yet received): 20151103125815.GA5825@mwanda
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 intnvme_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?
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')
Signed-off-by Dan Carpenter <[email protected]>
drivers/nvme/host/pci.c +1 -1
@@ -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); }
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')Signed-off-by Dan Carpenter <[email protected]>
Thanks Dan, applied.
Signature · 1 line
Jens Axboe