linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm: remove unnecessary pointer variables
@ 2025-08-11  3:42 Xichao Zhao
  2025-08-11  4:30 ` Anshuman Khandual
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Xichao Zhao @ 2025-08-11  3:42 UTC (permalink / raw)
  To: ryabinin.a.a, akpm
  Cc: glider, andreyknvl, dvyukov, vincenzo.frascino, kasan-dev,
	linux-mm, linux-kernel, Xichao Zhao

Simplify the code to enhance readability and maintain a consistent
coding style.

Signed-off-by: Xichao Zhao <zhao.xichao@vivo.com>
---
 mm/kasan/init.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/mm/kasan/init.c b/mm/kasan/init.c
index ced6b29fcf76..e5810134813c 100644
--- a/mm/kasan/init.c
+++ b/mm/kasan/init.c
@@ -266,11 +266,9 @@ int __ref kasan_populate_early_shadow(const void *shadow_start,
 		}
 
 		if (pgd_none(*pgd)) {
-			p4d_t *p;
 
 			if (slab_is_available()) {
-				p = p4d_alloc(&init_mm, pgd, addr);
-				if (!p)
+				if (!p4d_alloc(&init_mm, pgd, addr))
 					return -ENOMEM;
 			} else {
 				pgd_populate(&init_mm, pgd,
-- 
2.34.1



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

* Re: [PATCH] mm: remove unnecessary pointer variables
  2025-08-11  3:42 [PATCH] mm: remove unnecessary pointer variables Xichao Zhao
@ 2025-08-11  4:30 ` Anshuman Khandual
  2025-08-11 13:38 ` Andrey Konovalov
  2025-08-11 19:18 ` Vishal Moola (Oracle)
  2 siblings, 0 replies; 4+ messages in thread
From: Anshuman Khandual @ 2025-08-11  4:30 UTC (permalink / raw)
  To: Xichao Zhao, ryabinin.a.a, akpm
  Cc: glider, andreyknvl, dvyukov, vincenzo.frascino, kasan-dev,
	linux-mm, linux-kernel

On 11/08/25 9:12 AM, Xichao Zhao wrote:
> Simplify the code to enhance readability and maintain a consistent
> coding style.
> 
> Signed-off-by: Xichao Zhao <zhao.xichao@vivo.com>
> ---
>  mm/kasan/init.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/mm/kasan/init.c b/mm/kasan/init.c
> index ced6b29fcf76..e5810134813c 100644
> --- a/mm/kasan/init.c
> +++ b/mm/kasan/init.c
> @@ -266,11 +266,9 @@ int __ref kasan_populate_early_shadow(const void *shadow_start,
>  		}
>  
>  		if (pgd_none(*pgd)) {
> -			p4d_t *p;
>  
>  			if (slab_is_available()) {
> -				p = p4d_alloc(&init_mm, pgd, addr);
> -				if (!p)
> +				if (!p4d_alloc(&init_mm, pgd, addr))
>  					return -ENOMEM;
>  			} else {
>  				pgd_populate(&init_mm, pgd,

Agreed that p4d_t pointer here is just redundant.

Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>


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

* Re: [PATCH] mm: remove unnecessary pointer variables
  2025-08-11  3:42 [PATCH] mm: remove unnecessary pointer variables Xichao Zhao
  2025-08-11  4:30 ` Anshuman Khandual
@ 2025-08-11 13:38 ` Andrey Konovalov
  2025-08-11 19:18 ` Vishal Moola (Oracle)
  2 siblings, 0 replies; 4+ messages in thread
From: Andrey Konovalov @ 2025-08-11 13:38 UTC (permalink / raw)
  To: Xichao Zhao
  Cc: ryabinin.a.a, akpm, glider, dvyukov, vincenzo.frascino, kasan-dev,
	linux-mm, linux-kernel

On Mon, Aug 11, 2025 at 5:43 AM Xichao Zhao <zhao.xichao@vivo.com> wrote:
>
> Simplify the code to enhance readability and maintain a consistent
> coding style.
>
> Signed-off-by: Xichao Zhao <zhao.xichao@vivo.com>
> ---
>  mm/kasan/init.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/mm/kasan/init.c b/mm/kasan/init.c
> index ced6b29fcf76..e5810134813c 100644
> --- a/mm/kasan/init.c
> +++ b/mm/kasan/init.c
> @@ -266,11 +266,9 @@ int __ref kasan_populate_early_shadow(const void *shadow_start,
>                 }
>
>                 if (pgd_none(*pgd)) {
> -                       p4d_t *p;
>
>                         if (slab_is_available()) {
> -                               p = p4d_alloc(&init_mm, pgd, addr);
> -                               if (!p)
> +                               if (!p4d_alloc(&init_mm, pgd, addr))
>                                         return -ENOMEM;
>                         } else {
>                                 pgd_populate(&init_mm, pgd,
> --
> 2.34.1
>

Reviewed-by: Andrey Konovalov <andreyknvl@gmail.com>


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

* Re: [PATCH] mm: remove unnecessary pointer variables
  2025-08-11  3:42 [PATCH] mm: remove unnecessary pointer variables Xichao Zhao
  2025-08-11  4:30 ` Anshuman Khandual
  2025-08-11 13:38 ` Andrey Konovalov
@ 2025-08-11 19:18 ` Vishal Moola (Oracle)
  2 siblings, 0 replies; 4+ messages in thread
From: Vishal Moola (Oracle) @ 2025-08-11 19:18 UTC (permalink / raw)
  To: Xichao Zhao
  Cc: ryabinin.a.a, akpm, glider, andreyknvl, dvyukov,
	vincenzo.frascino, kasan-dev, linux-mm, linux-kernel

On Mon, Aug 11, 2025 at 11:42:57AM +0800, Xichao Zhao wrote:
> Simplify the code to enhance readability and maintain a consistent
> coding style.
> 
> Signed-off-by: Xichao Zhao <zhao.xichao@vivo.com>
> ---
>  mm/kasan/init.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/mm/kasan/init.c b/mm/kasan/init.c
> index ced6b29fcf76..e5810134813c 100644
> --- a/mm/kasan/init.c
> +++ b/mm/kasan/init.c
> @@ -266,11 +266,9 @@ int __ref kasan_populate_early_shadow(const void *shadow_start,
>  		}
>  
>  		if (pgd_none(*pgd)) {
> -			p4d_t *p;
>

Nit - Get rid of the empty line between the if statements.

Aside from that, LGTM.
Reviewed-by: Vishal Moola (Oracle) <vishal.moola@gmail.com>

>  			if (slab_is_available()) {
> -				p = p4d_alloc(&init_mm, pgd, addr);
> -				if (!p)
> +				if (!p4d_alloc(&init_mm, pgd, addr))
>  					return -ENOMEM;
>  			} else {
>  				pgd_populate(&init_mm, pgd,
> -- 
> 2.34.1
> 


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

end of thread, other threads:[~2025-08-11 19:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-11  3:42 [PATCH] mm: remove unnecessary pointer variables Xichao Zhao
2025-08-11  4:30 ` Anshuman Khandual
2025-08-11 13:38 ` Andrey Konovalov
2025-08-11 19:18 ` Vishal Moola (Oracle)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).