[PATCH -next v6 1/2] mm/zswap: skip invalid or unchanged parameter

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If parameter is invalid or no change required, return directly. This can
reduces unnecessary printing.

Signed-off-by: Liu Shixin <liushixin2@xxxxxxxxxx>
---
 mm/zswap.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/mm/zswap.c b/mm/zswap.c
index 2f0ebd8bc620..09fa956920fa 100644
--- a/mm/zswap.c
+++ b/mm/zswap.c
@@ -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;
-- 
2.25.1





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux