Skip to contentSkip to conversation

mm-damon-core-simplify-control-flow-in-damon_register_ops.patch removed from -mm tree

merged mm-stable Andrew Morton 1 participant 1 message Apr 1, 2025

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: mm/damon/core: simplify control flow in damon_register_ops()
has been removed from the -mm tree. Its filename was
mm-damon-core-simplify-control-flow-in-damon_register_ops.patch

This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: Taotao Chen <[email protected]>
Subject: mm/damon/core: simplify control flow in damon_register_ops()
Date: Thu, 20 Mar 2025 18:44:00 +0800

The function logic is not complex, so using goto is unnecessary. Replace it with a straightforward if-else to simplify control flow and improve readability.

---

 mm/damon/core.c |    9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
mm/damon/core.c renamed from mm/damon/core.c~mm-damon-core-simplify-control-flow-in-damon_register_ops +4 -5
@@ -76,14 +76,13 @@ int damon_register_ops(struct damon_oper
 
 	if (ops->id >= NR_DAMON_OPS)
 		return -EINVAL;
+
 	mutex_lock(&damon_ops_lock);
 	/* Fail for already registered ops */
-	if (__damon_is_registered_ops(ops->id)) {
+	if (__damon_is_registered_ops(ops->id))
 		err = -EINVAL;
-		goto out;
-	}
-	damon_registered_ops[ops->id] = *ops;
-out:
+	else
+		damon_registered_ops[ops->id] = *ops;
 	mutex_unlock(&damon_ops_lock);
 	return err;
 }

_

Patches currently in -mm which might be from [email protected] are