[PATCH] mm/memblock: simplify reserve_mem_init error handling

Hongfu Li posted 1 patch 1 month, 1 week ago
mm/memblock.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
[PATCH] mm/memblock: simplify reserve_mem_init error handling
Posted by Hongfu Li 1 month, 1 week ago
From: Hongfu Li <lihongfu@kylinos.cn>

Return prepare_kho_fdt() directly instead of assigning to a local and
returning it on both success and failure paths.

Signed-off-by: Hongfu Li <lihongfu@kylinos.cn>
---
 mm/memblock.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/mm/memblock.c b/mm/memblock.c
index 777c69f05400..7079b93ec730 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -2616,15 +2616,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.54.0
Re: [PATCH] mm/memblock: simplify reserve_mem_init error handling
Posted by Sang-Heon Jeon 1 month, 1 week ago
On Fri, Aug 21, 2026 at 11:32:30AM +0800, Hongfu Li wrote:
> Return prepare_kho_fdt() directly instead of assigning to a local and
> returning it on both success and failure paths.

Thanks for the patch, but the same change was already posted [1].
As mentioned in the cover letter, I can send it as a separate patch
if needed.

[1] https://lore.kernel.org/all/20260723184538.3888637-37-ekffu200098@gmail.com/

Best Regards,
Sang-Heon Jeon
Re: [PATCH] mm/memblock: simplify reserve_mem_init error handling
Posted by Mike Rapoport 1 month ago
On Sat, Aug 22, 2026 at 12:23:23PM +0900, Sang-Heon Jeon wrote:
> On Fri, Aug 21, 2026 at 11:32:30AM +0800, Hongfu Li wrote:
> > Return prepare_kho_fdt() directly instead of assigning to a local and
> > returning it on both success and failure paths.
> 
> Thanks for the patch, but the same change was already posted [1].
> As mentioned in the cover letter, I can send it as a separate patch
> if needed.

Please send it as as separate patch, as Mark requested.

Hongfu, I'm planning take that one because he was the first.
 
> [1] https://lore.kernel.org/all/20260723184538.3888637-37-ekffu200098@gmail.com/
> 
> Best Regards,
> Sang-Heon Jeon

-- 
Sincerely yours,
Mike.
Re: [PATCH] mm/memblock: simplify reserve_mem_init error handling
Posted by Hongfu Li 1 month ago
On 8/23/26 10:30 PM, Mike Rapoport wrote:
> On Sat, Aug 22, 2026 at 12:23:23PM +0900, Sang-Heon Jeon wrote:
>> On Fri, Aug 21, 2026 at 11:32:30AM +0800, Hongfu Li wrote:
>>> Return prepare_kho_fdt() directly instead of assigning to a local and
>>> returning it on both success and failure paths.
>> Thanks for the patch, but the same change was already posted [1].
>> As mentioned in the cover letter, I can send it as a separate patch
>> if needed.
> Please send it as as separate patch, as Mark requested.
>
> Hongfu, I'm planning take that one because he was the first.

OK, understood. I withdraw this patch. Thanks.

>> [1] https://lore.kernel.org/all/20260723184538.3888637-37-ekffu200098@gmail.com/
>>
>> Best Regards,
>> Sang-Heon Jeon

-- 
Best regards,
Hongfu