Commit 419a0555 authored by Alessandro Rubini's avatar Alessandro Rubini

trivial: sysfs: simplify zobj_store_enable

Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent 701703e8
......@@ -553,18 +553,14 @@ static ssize_t zobj_store_enable(struct device *dev,
spinlock_t *lock;
err = strict_strtol(buf, 0, &val);
if (err)
if (err || val < 0 || val > 1)
return -EINVAL;
lock = __get_spinlock(to_zio_head(dev));
/* change enable status */
if (unlikely(strcmp(attr->attr.name, ZOBJ_SYSFS_ENABLE) == 0 &&
(val == 0 || val == 1))) {
spin_lock(lock);
__zobj_enable(dev, val);
spin_unlock(lock);
return count;
}
spin_lock(lock);
__zobj_enable(dev, val);
spin_unlock(lock);
return count;
return count;
}
......
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