Skip to content

Commit

Permalink
memory tier: release the new_memtier in find_create_memory_tier()
Browse files Browse the repository at this point in the history
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/[email protected]
Fixes: 9832fb8 ("mm/demotion: expose memory tier details via sysfs")
Signed-off-by: Tong Tiangen <[email protected]>
Cc: Aneesh Kumar K.V <[email protected]>
Cc: Hanjun Guo <[email protected]>
Cc: Kefeng Wang <[email protected]>
Cc: Guohanjun <[email protected]>
Cc: <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
  • Loading branch information
Tong Tiangen authored and akpm00 committed Feb 10, 2023
1 parent 8f17feb commit 9341913
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mm/memory-tiers.c
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,8 @@ static struct memory_tier *find_create_memory_tier(struct memory_dev_type *memty

ret = device_register(&new_memtier->dev);
if (ret) {
list_del(&memtier->list);
put_device(&memtier->dev);
list_del(&new_memtier->list);
put_device(&new_memtier->dev);
return ERR_PTR(ret);
}
memtier = new_memtier;
Expand Down

0 comments on commit 9341913

Please sign in to comment.