linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/demotion: Fix NULL vs IS_ERR checking in memory_tier_init
@ 2022-11-10  3:07 Miaoqian Lin
  2022-11-10  3:09 ` Huang, Ying
  0 siblings, 1 reply; 2+ messages in thread
From: Miaoqian Lin @ 2022-11-10  3:07 UTC (permalink / raw)
  To: Andrew Morton, Wei Xu, Huang, Ying, Aneesh Kumar K.V, linux-mm,
	linux-kernel
  Cc: linmq006

The alloc_memory_type() function return error pointers on error
instead of NULL.
Use IS_ERR() to check the return value to fix this.

Fixes: 7b88bda3761b ("mm/demotion/dax/kmem: set node's abstract distance to MEMTIER_DEFAULT_DAX_ADISTANCE")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
---
 mm/memory-tiers.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/memory-tiers.c b/mm/memory-tiers.c
index fa8c9d07f9ce..ac0dae9e54bf 100644
--- a/mm/memory-tiers.c
+++ b/mm/memory-tiers.c
@@ -645,7 +645,7 @@ static int __init memory_tier_init(void)
 	 * than default DRAM tier.
 	 */
 	default_dram_type = alloc_memory_type(MEMTIER_ADISTANCE_DRAM);
-	if (!default_dram_type)
+	if (IS_ERR(default_dram_type))
 		panic("%s() failed to allocate default DRAM tier\n", __func__);
 
 	/*
-- 
2.37.3.671.ge2130fe6da78.dirty



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

* Re: [PATCH] mm/demotion: Fix NULL vs IS_ERR checking in memory_tier_init
  2022-11-10  3:07 [PATCH] mm/demotion: Fix NULL vs IS_ERR checking in memory_tier_init Miaoqian Lin
@ 2022-11-10  3:09 ` Huang, Ying
  0 siblings, 0 replies; 2+ messages in thread
From: Huang, Ying @ 2022-11-10  3:09 UTC (permalink / raw)
  To: Miaoqian Lin
  Cc: Andrew Morton, Wei Xu, Aneesh Kumar K.V, linux-mm, linux-kernel

Miaoqian Lin <linmq006@gmail.com> writes:

> The alloc_memory_type() function return error pointers on error
> instead of NULL.
> Use IS_ERR() to check the return value to fix this.
>
> Fixes: 7b88bda3761b ("mm/demotion/dax/kmem: set node's abstract distance to MEMTIER_DEFAULT_DAX_ADISTANCE")
> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>

Thanks!

Reviewed-by: "Huang, Ying" <ying.huang@intel.com>

> ---
>  mm/memory-tiers.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/memory-tiers.c b/mm/memory-tiers.c
> index fa8c9d07f9ce..ac0dae9e54bf 100644
> --- a/mm/memory-tiers.c
> +++ b/mm/memory-tiers.c
> @@ -645,7 +645,7 @@ static int __init memory_tier_init(void)
>  	 * than default DRAM tier.
>  	 */
>  	default_dram_type = alloc_memory_type(MEMTIER_ADISTANCE_DRAM);
> -	if (!default_dram_type)
> +	if (IS_ERR(default_dram_type))
>  		panic("%s() failed to allocate default DRAM tier\n", __func__);
>  
>  	/*


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

end of thread, other threads:[~2022-11-10  3:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-10  3:07 [PATCH] mm/demotion: Fix NULL vs IS_ERR checking in memory_tier_init Miaoqian Lin
2022-11-10  3:09 ` Huang, Ying

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