memory tier: release the new_memtier in find_create_memory_tier()
authorTong Tiangen <tongtiangen@huawei.com>
Sun, 29 Jan 2023 04:06:51 +0000 (04:06 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 10 Mar 2023 08:34:27 +0000 (09:34 +0100)
commit313b18c77466ef849439b0c80597da5b4e73f012
tree28b020716cbeafe5ddc1c0e25c045c3636c8247e
parente10a97f684809cfa7fcae04f7c1d234fbb1859d3
memory tier: release the new_memtier in find_create_memory_tier()

commit 93419139fa14124c1c507d804f2b28866ebee28d upstream.

In find_create_memory_tier(), if failed to register device, then we should
release new_memtier from the tier list and put device instead of memtier.

Link: https://lkml.kernel.org/r/20230129040651.1329208-1-tongtiangen@huawei.com
Fixes: 9832fb87834e ("mm/demotion: expose memory tier details via sysfs")
Signed-off-by: Tong Tiangen <tongtiangen@huawei.com>
Cc: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
Cc: Hanjun Guo <guohanjun@huawei.com>
Cc: Kefeng Wang <wangkefeng.wang@huawei.com>
Cc: Guohanjun <guohanjun@huawei.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
mm/memory-tiers.c