[-next,v6,1/2] mm/zswap: skip invalid or unchanged parameter
Commit Message
If parameter is invalid or no change required, return directly. This can
reduces unnecessary printing.
Signed-off-by: Liu Shixin <liushixin2@huawei.com>
---
mm/zswap.c | 9 +++++++++
1 file changed, 9 insertions(+)
@@ -875,6 +875,15 @@ static int zswap_zpool_param_set(const char *val,
static int zswap_enabled_param_set(const char *val,
const struct kernel_param *kp)
{
+ bool res;
+
+ if (kstrtobool(val, &res))
+ return -EINVAL;
+
+ /* no change required */
+ if (res == *(bool *)kp->arg)
+ return 0;
+
if (zswap_init_failed) {
pr_err("can't enable, initialization failed\n");
return -ENODEV;