Skip to content

Commit 85d3266

Browse files
Yuuoniyngboonkhai
authored andcommitted
mm/demotion: fix NULL vs IS_ERR checking in memory_tier_init
alloc_memory_type() returns error pointers on error instead of NULL. Use IS_ERR() to check the return value to fix this. Link: https://lkml.kernel.org/r/20221110030751.1627266-1-linmq006@gmail.com Fixes: 7b88bda ("mm/demotion/dax/kmem: set node's abstract distance to MEMTIER_DEFAULT_DAX_ADISTANCE") Signed-off-by: Miaoqian Lin <linmq006@gmail.com> Reviewed-by: "Huang, Ying" <ying.huang@intel.com> Cc: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com> Cc: Wei Xu <weixugc@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
1 parent 1bb2526 commit 85d3266

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

mm/memory-tiers.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -645,7 +645,7 @@ static int __init memory_tier_init(void)
645645
* than default DRAM tier.
646646
*/
647647
default_dram_type = alloc_memory_type(MEMTIER_ADISTANCE_DRAM);
648-
if (!default_dram_type)
648+
if (IS_ERR(default_dram_type))
649649
panic("%s() failed to allocate default DRAM tier\n", __func__);
650650

651651
/*

0 commit comments

Comments
 (0)