From: Andrew Morton <akpm@linux-foundation.org>
To: Sang-Heon Jeon <ekffu200098@gmail.com>
Cc: Mike Rapoport <rppt@kernel.org>, linux-mm@kvack.org
Subject: Re: [PATCH v2] memblock: remove conditional return with no effect
Date: Mon, 24 Aug 2026 11:58:22 -0700 [thread overview]
Message-ID: <20260824115822.6e41bd0cacd471a8074623f8@linux-foundation.org> (raw)
In-Reply-To: <20260823154840.3793140-1-ekffu200098@gmail.com>
On Mon, 24 Aug 2026 00:48:38 +0900 Sang-Heon Jeon <ekffu200098@gmail.com> 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 <akpm@linux-foundation.org>
Your patch led Sashiko to suggest the addition of a round_up() in
nearby code:
https://sashiko.dev/#/patchset/20260823154840.3793140-1-ekffu200098@gmail.com
prev parent reply other threads:[~2026-08-24 18:58 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-23 15:48 [PATCH v2] memblock: remove conditional return with no effect Sang-Heon Jeon
2026-08-24 15:18 ` Mike Rapoport
2026-08-24 18:58 ` Andrew Morton [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260824115822.6e41bd0cacd471a8074623f8@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=ekffu200098@gmail.com \
--cc=linux-mm@kvack.org \
--cc=rppt@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox