[PATCH 3/3] mm: remove the non-useful else after a break in a if statement

Keren Sun posted 3 patches 1 week, 2 days ago
[PATCH 3/3] mm: remove the non-useful else after a break in a if statement
Posted by Keren Sun 1 week, 2 days ago
Remove the else block since there is already a break in the statement of
if (iter->oom_lock), just set iter->oom_lock true after the if block
ends.

Signed-off-by: Keren Sun <kerensun@google.com>
---
 mm/memcontrol-v1.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mm/memcontrol-v1.c b/mm/memcontrol-v1.c
index 4cbbced0c8a1..423c861acdd8 100644
--- a/mm/memcontrol-v1.c
+++ b/mm/memcontrol-v1.c
@@ -1148,8 +1148,8 @@ static bool mem_cgroup_oom_trylock(struct mem_cgroup *memcg)
 			failed = iter;
 			mem_cgroup_iter_break(memcg, iter);
 			break;
-		} else
-			iter->oom_lock = true;
+		}
+		iter->oom_lock = true;
 	}
 
 	if (failed) {
-- 
2.47.0.338.g60cca15819-goog
Re: [PATCH 3/3] mm: remove the non-useful else after a break in a if statement
Posted by Roman Gushchin 6 days, 13 hours ago
On Fri, Nov 15, 2024 at 03:57:44PM -0800, Keren Sun wrote:
> Remove the else block since there is already a break in the statement of
> if (iter->oom_lock), just set iter->oom_lock true after the if block
> ends.
> 
> Signed-off-by: Keren Sun <kerensun@google.com>

Reviewed-by: Roman Gushchin <roman.gushchin@linux.dev>

Thanks!