aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2018-06-07 04:27:41 -0400
committerJens Axboe <axboe@kernel.dk>2018-06-08 14:51:11 -0400
commit77016199f11eacd7b23e2faeb4d0f36166e3530b (patch)
treef057546cbab3803e4469af86bebfb6aa0fbf4ca2
parent69f4eb9ff79556c1a3daf5af5573594c196f30cc (diff)
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>
-rw-r--r--drivers/nvme/host/core.c4
-rw-r--r--drivers/nvme/host/nvme.h1
2 files changed, 2 insertions, 3 deletions
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 04a20da76786..e2dcd14012b1 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -3245,7 +3245,7 @@ static void nvme_scan_work(struct work_struct *work)
3245 3245
3246 WARN_ON_ONCE(!ctrl->tagset); 3246 WARN_ON_ONCE(!ctrl->tagset);
3247 3247
3248 if (test_and_clear_bit(EVENT_NS_CHANGED, &ctrl->events)) { 3248 if (test_and_clear_bit(NVME_AER_NOTICE_NS_CHANGED, &ctrl->events)) {
3249 if (nvme_scan_changed_ns_log(ctrl)) 3249 if (nvme_scan_changed_ns_log(ctrl))
3250 goto out_sort_namespaces; 3250 goto out_sort_namespaces;
3251 dev_info(ctrl->device, "rescanning namespaces.\n"); 3251 dev_info(ctrl->device, "rescanning namespaces.\n");
@@ -3386,7 +3386,7 @@ static void nvme_handle_aen_notice(struct nvme_ctrl *ctrl, u32 result)
3386{ 3386{
3387 switch ((result & 0xff00) >> 8) { 3387 switch ((result & 0xff00) >> 8) {
3388 case NVME_AER_NOTICE_NS_CHANGED: 3388 case NVME_AER_NOTICE_NS_CHANGED:
3389 set_bit(EVENT_NS_CHANGED, &ctrl->events); 3389 set_bit(NVME_AER_NOTICE_NS_CHANGED, &ctrl->events);
3390 nvme_queue_scan(ctrl); 3390 nvme_queue_scan(ctrl);
3391 break; 3391 break;
3392 case NVME_AER_NOTICE_FW_ACT_STARTING: 3392 case NVME_AER_NOTICE_FW_ACT_STARTING:
diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
index de24fe77c80b..34df07d44f80 100644
--- a/drivers/nvme/host/nvme.h
+++ b/drivers/nvme/host/nvme.h
@@ -194,7 +194,6 @@ struct nvme_ctrl {
194 struct delayed_work ka_work; 194 struct delayed_work ka_work;
195 struct nvme_command ka_cmd; 195 struct nvme_command ka_cmd;
196 struct work_struct fw_act_work; 196 struct work_struct fw_act_work;
197#define EVENT_NS_CHANGED (1 << 0)
198 unsigned long events; 197 unsigned long events;
199 198
200 /* Power saving configuration */ 199 /* Power saving configuration */