linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] memblock: Return NUMA_NO_NODE instead of -1 to improve code readability
@ 2023-12-07 13:10 Yuntao Wang
  2023-12-08  9:35 ` Mike Rapoport
  0 siblings, 1 reply; 2+ messages in thread
From: Yuntao Wang @ 2023-12-07 13:10 UTC (permalink / raw)
  To: linux-kernel, linux-mm; +Cc: Mike Rapoport, Andrew Morton, Yuntao Wang

When no corresponding memory region is found for the given pfn, return
NUMA_NO_NODE instead of -1. This improves code readability and aligns with
the existing logic of the memblock_search_pfn_nid() function's user.

Signed-off-by: Yuntao Wang <ytcoode@gmail.com>
---
 mm/memblock.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/memblock.c b/mm/memblock.c
index 5a88d6d24d79..c1f579c23396 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -1851,7 +1851,7 @@ int __init_memblock memblock_search_pfn_nid(unsigned long pfn,
 	int mid = memblock_search(type, PFN_PHYS(pfn));
 
 	if (mid == -1)
-		return -1;
+		return NUMA_NO_NODE;
 
 	*start_pfn = PFN_DOWN(type->regions[mid].base);
 	*end_pfn = PFN_DOWN(type->regions[mid].base + type->regions[mid].size);
-- 
2.43.0



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] memblock: Return NUMA_NO_NODE instead of -1 to improve code readability
  2023-12-07 13:10 [PATCH] memblock: Return NUMA_NO_NODE instead of -1 to improve code readability Yuntao Wang
@ 2023-12-08  9:35 ` Mike Rapoport
  0 siblings, 0 replies; 2+ messages in thread
From: Mike Rapoport @ 2023-12-08  9:35 UTC (permalink / raw)
  To: Yuntao Wang; +Cc: linux-kernel, linux-mm, Andrew Morton

On Thu, Dec 07, 2023 at 09:10:01PM +0800, Yuntao Wang wrote:
> When no corresponding memory region is found for the given pfn, return
> NUMA_NO_NODE instead of -1. This improves code readability and aligns with
> the existing logic of the memblock_search_pfn_nid() function's user.
> 
> Signed-off-by: Yuntao Wang <ytcoode@gmail.com>

Applied, thanks!

> ---
>  mm/memblock.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mm/memblock.c b/mm/memblock.c
> index 5a88d6d24d79..c1f579c23396 100644
> --- a/mm/memblock.c
> +++ b/mm/memblock.c
> @@ -1851,7 +1851,7 @@ int __init_memblock memblock_search_pfn_nid(unsigned long pfn,
>  	int mid = memblock_search(type, PFN_PHYS(pfn));
>  
>  	if (mid == -1)
> -		return -1;
> +		return NUMA_NO_NODE;
>  
>  	*start_pfn = PFN_DOWN(type->regions[mid].base);
>  	*end_pfn = PFN_DOWN(type->regions[mid].base + type->regions[mid].size);
> -- 
> 2.43.0
> 

-- 
Sincerely yours,
Mike.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-12-08  9:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-07 13:10 [PATCH] memblock: Return NUMA_NO_NODE instead of -1 to improve code readability Yuntao Wang
2023-12-08  9:35 ` Mike Rapoport

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox