[PATCH 1/2] mm/kmemleak: Remove unreachable return statement in scan_should_stop()

Zhongqiu Han posted 2 patches 1 week, 3 days ago
[PATCH 1/2] mm/kmemleak: Remove unreachable return statement in scan_should_stop()
Posted by Zhongqiu Han 1 week, 3 days ago
Remove unreachable "return 0;" statement as all execution paths return
before reaching it.

No functional change.

Signed-off-by: Zhongqiu Han <zhongqiu.han@oss.qualcomm.com>
---
 mm/kmemleak.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/mm/kmemleak.c b/mm/kmemleak.c
index fe33f2edfe07..fb0022f34393 100644
--- a/mm/kmemleak.c
+++ b/mm/kmemleak.c
@@ -1509,10 +1509,8 @@ static int scan_should_stop(void)
 	 */
 	if (current->mm)
 		return signal_pending(current);
-	else
-		return kthread_should_stop();
 
-	return 0;
+	return kthread_should_stop();
 }
 
 /*
-- 
2.43.0
Re: [PATCH 1/2] mm/kmemleak: Remove unreachable return statement in scan_should_stop()
Posted by Catalin Marinas 5 days, 22 hours ago
On Fri, Jan 30, 2026 at 05:37:28PM +0800, Zhongqiu Han wrote:
> Remove unreachable "return 0;" statement as all execution paths return
> before reaching it.
> 
> No functional change.
> 
> Signed-off-by: Zhongqiu Han <zhongqiu.han@oss.qualcomm.com>
> ---
>  mm/kmemleak.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/mm/kmemleak.c b/mm/kmemleak.c
> index fe33f2edfe07..fb0022f34393 100644
> --- a/mm/kmemleak.c
> +++ b/mm/kmemleak.c
> @@ -1509,10 +1509,8 @@ static int scan_should_stop(void)
>  	 */
>  	if (current->mm)
>  		return signal_pending(current);
> -	else
> -		return kthread_should_stop();
>  
> -	return 0;
> +	return kthread_should_stop();
>  }

Yeah, not sure how I ended up with this.

Acked-by: Catalin Marinas <catalin.marinas@arm.com>