* [PATCH v2] memblock: remove conditional return with no effect
@ 2026-08-23 15:48 Sang-Heon Jeon
2026-08-24 15:18 ` Mike Rapoport
2026-08-24 18:58 ` Andrew Morton
0 siblings, 2 replies; 3+ messages in thread
From: Sang-Heon Jeon @ 2026-08-23 15:48 UTC (permalink / raw)
To: Andrew Morton, Mike Rapoport; +Cc: linux-mm
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.
Signed-off-by: Sang-Heon Jeon <ekffu200098@gmail.com>
---
The memblock patch of the treewide v1 series [1] is posted separately.
You can find the Coccinelle script in v1 [1].
---
Changes from v1 [1]
- Change base to memblock/for-next
- Filter only memblock changes
[1] https://lore.kernel.org/all/20260723184538.3888637-1-ekffu200098@gmail.com/
---
mm/memblock.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/mm/memblock.c b/mm/memblock.c
index 43e036f3e11a..9a31781923fb 100644
--- 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);
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] memblock: remove conditional return with no effect
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
1 sibling, 0 replies; 3+ messages in thread
From: Mike Rapoport @ 2026-08-24 15:18 UTC (permalink / raw)
To: Sang-Heon Jeon; +Cc: Andrew Morton, linux-mm
On Mon, Aug 24, 2026 at 12:48:38AM +0900, Sang-Heon Jeon 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.
>
> Signed-off-by: Sang-Heon Jeon <ekffu200098@gmail.com>
It's queued now and will appear in the memblock tree after the merge
window.
--
Sincerely yours,
Mike.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] memblock: remove conditional return with no effect
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
1 sibling, 0 replies; 3+ messages in thread
From: Andrew Morton @ 2026-08-24 18:58 UTC (permalink / raw)
To: Sang-Heon Jeon; +Cc: Mike Rapoport, linux-mm
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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-08-24 18:58 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox