nvme: cleanup double shift issue for-linus-20180608
authorDan Carpenter <dan.carpenter@oracle.com>
Thu, 7 Jun 2018 08:27:41 +0000 (11:27 +0300)
committerJens Axboe <axboe@kernel.dk>
Fri, 8 Jun 2018 18:51:11 +0000 (12:51 -0600)
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>
drivers/nvme/host/core.c
drivers/nvme/host/nvme.h

index 04a20da767868e84f5eb9a24752dc0e02f5901aa..e2dcd14012b19669f94c4eea07bb047c7df2e76a 100644 (file)
@@ -3245,7 +3245,7 @@ static void nvme_scan_work(struct work_struct *work)
 
        WARN_ON_ONCE(!ctrl->tagset);
 
-       if (test_and_clear_bit(EVENT_NS_CHANGED, &ctrl->events)) {
+       if (test_and_clear_bit(NVME_AER_NOTICE_NS_CHANGED, &ctrl->events)) {
                if (nvme_scan_changed_ns_log(ctrl))
                        goto out_sort_namespaces;
                dev_info(ctrl->device, "rescanning namespaces.\n");
@@ -3386,7 +3386,7 @@ static void nvme_handle_aen_notice(struct nvme_ctrl *ctrl, u32 result)
 {
        switch ((result & 0xff00) >> 8) {
        case NVME_AER_NOTICE_NS_CHANGED:
-               set_bit(EVENT_NS_CHANGED, &ctrl->events);
+               set_bit(NVME_AER_NOTICE_NS_CHANGED, &ctrl->events);
                nvme_queue_scan(ctrl);
                break;
        case NVME_AER_NOTICE_FW_ACT_STARTING:
index de24fe77c80b8d3f299799b0a97be8bc9784ce32..34df07d44f8071e51f0c27bde7ade5c15bf2c00a 100644 (file)
@@ -194,7 +194,6 @@ struct nvme_ctrl {
        struct delayed_work ka_work;
        struct nvme_command ka_cmd;
        struct work_struct fw_act_work;
-#define EVENT_NS_CHANGED               (1 << 0)
        unsigned long events;
 
        /* Power saving configuration */