Re: [PATCH v2] memblock: remove conditional return with no effect

Andrew Morton <[email protected]>
Newsgroups org.kvack.linux-mm
Message-ID <[email protected]>
On Mon, 24 Aug 2026 00:48:38 +0900 Sang-Heon Jeon <[email protected]> wrote:

> Both branches of the check return the same value, so the check has
> no effect. Remove it and return the value directly.
> 
> This is the result of running the Coccinelle script from
> scripts/coccinelle/misc/cond_return_no_effect.cocci.
> 
> ...
>
> --- a/mm/memblock.c
> +++ b/mm/memblock.c
> @@ -2613,15 +2613,10 @@ static int __init prepare_kho_fdt(void)
>  
>  static int __init reserve_mem_init(void)
>  {
> -	int err;
> -
>  	if (!kho_is_enabled() || !reserved_mem_count)
>  		return 0;
>  
> -	err = prepare_kho_fdt();
> -	if (err)
> -		return err;
> -	return err;
> +	return prepare_kho_fdt();
>  }
>  late_initcall(reserve_mem_init);

Reviewed-by: Andrew Morton <[email protected]>

Your patch led Sashiko to suggest the addition of a round_up() in
nearby code:

	https://sashiko.dev/#/patchset/[email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.