Skip to content

Commit 7701619

Browse files
Dan Carpenteraxboe
authored andcommitted
nvme: cleanup double shift issue
The problem here is that set_bit() and test_bit() take a bit number so we should be passing 0 but instead we're passing (1 << 0) which leads to a double shift. It doesn't cause a runtime bug in the current code because it's done consistently and we only set that one bit. I decided to just re-use NVME_AER_NOTICE_NS_CHANGED instead of introducing a new define for this. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Reviewed-by: Sagi Grimberg <sagi@grimberg.me> Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 69f4eb9 commit 7701619

2 files changed

Lines changed: 2 additions & 3 deletions

File tree

‎drivers/nvme/host/core.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3245,7 +3245,7 @@ static void nvme_scan_work(struct work_struct *work)
32453245

32463246
WARN_ON_ONCE(!ctrl->tagset);
32473247

3248-
if (test_and_clear_bit(EVENT_NS_CHANGED, &ctrl->events)) {
3248+
if (test_and_clear_bit(NVME_AER_NOTICE_NS_CHANGED, &ctrl->events)) {
32493249
if (nvme_scan_changed_ns_log(ctrl))
32503250
goto out_sort_namespaces;
32513251
dev_info(ctrl->device, "rescanning namespaces.\n");
@@ -3386,7 +3386,7 @@ static void nvme_handle_aen_notice(struct nvme_ctrl *ctrl, u32 result)
33863386
{
33873387
switch ((result & 0xff00) >> 8) {
33883388
case NVME_AER_NOTICE_NS_CHANGED:
3389-
set_bit(EVENT_NS_CHANGED, &ctrl->events);
3389+
set_bit(NVME_AER_NOTICE_NS_CHANGED, &ctrl->events);
33903390
nvme_queue_scan(ctrl);
33913391
break;
33923392
case NVME_AER_NOTICE_FW_ACT_STARTING:

‎drivers/nvme/host/nvme.h‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,6 @@ struct nvme_ctrl {
194194
struct delayed_work ka_work;
195195
struct nvme_command ka_cmd;
196196
struct work_struct fw_act_work;
197-
#define EVENT_NS_CHANGED (1 << 0)
198197
unsigned long events;
199198

200199
/* Power saving configuration */

0 commit comments

Comments
 (0)