Commit 88402c5b authored by Dave Jiang's avatar Dave Jiang Committed by Vinod Koul

dmaengine: idxd: sysfs input of wq incorrect wq type should return error

Currently when inputing an unrecognized wq type, we set the wq type to
"none". It really should return error and not change the existing wq type
that's in the kernel.

Fixes: c52ca478 ("dmaengine: idxd: add configuration component of driver")
Reported-by: default avatarYixin Zhang <yixin.zhang@intel.com>
Signed-off-by: default avatarDave Jiang <dave.jiang@intel.com>
Link: https://lore.kernel.org/r/158213304803.2290.13336343633425868211.stgit@djiang5-desk3.ch.intel.comSigned-off-by: default avatarVinod Koul <vkoul@kernel.org>
parent 36d5d220
...@@ -1002,12 +1002,14 @@ static ssize_t wq_type_store(struct device *dev, ...@@ -1002,12 +1002,14 @@ static ssize_t wq_type_store(struct device *dev,
return -EPERM; return -EPERM;
old_type = wq->type; old_type = wq->type;
if (sysfs_streq(buf, idxd_wq_type_names[IDXD_WQT_KERNEL])) if (sysfs_streq(buf, idxd_wq_type_names[IDXD_WQT_NONE]))
wq->type = IDXD_WQT_NONE;
else if (sysfs_streq(buf, idxd_wq_type_names[IDXD_WQT_KERNEL]))
wq->type = IDXD_WQT_KERNEL; wq->type = IDXD_WQT_KERNEL;
else if (sysfs_streq(buf, idxd_wq_type_names[IDXD_WQT_USER])) else if (sysfs_streq(buf, idxd_wq_type_names[IDXD_WQT_USER]))
wq->type = IDXD_WQT_USER; wq->type = IDXD_WQT_USER;
else else
wq->type = IDXD_WQT_NONE; return -EINVAL;
/* If we are changing queue type, clear the name */ /* If we are changing queue type, clear the name */
if (wq->type != old_type) if (wq->type != old_type)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment