It's confusing when we disable zswap while zswap is init failed or has no
pool. If no change required, just return directly.
Link: https://lkml.kernel.org/r/20220825142037.3214152-4-liushixin2@huawei.com
Signed-off-by: Liu Shixin <liushixin2@huawei.com>
Cc: Dan Streetman <ddstreet@ieee.org>
Cc: Seth Jennings <sjenning@redhat.com>
Cc: Vitaly Wool <vitaly.wool@konsulko.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
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 (system_state == SYSTEM_RUNNING) {
mutex_lock(&zswap_init_lock);
if (zswap_setup()) {