diff options
author | Johannes Weiner <hannes@cmpxchg.org> | 2024-01-29 20:36:41 -0500 |
---|---|---|
committer | Andrew Morton <akpm@linux-foundation.org> | 2024-02-22 10:24:43 -0800 |
commit | dab7711fac6dd3c45471bfb3b6b5336e8fa900a2 (patch) | |
tree | bb68a81715f653093e15e4ecf6656ed4f650e384 /mm/zswap.c | |
parent | e477559ca602a033e3970ebdbbfb39773345d694 (diff) |
mm: zswap: clean up zswap_entry_put()
Remove stale comment and unnecessary local variable.
Link: https://lkml.kernel.org/r/20240130014208.565554-6-hannes@cmpxchg.org
Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
Acked-by: Yosry Ahmed <yosryahmed@google.com>
Reviewed-by: Nhat Pham <nphamcs@gmail.com>
Reviewed-by: Chengming Zhou <zhouchengming@bytedance.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'mm/zswap.c')
-rw-r--r-- | mm/zswap.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/mm/zswap.c b/mm/zswap.c index 70e409add32b..32bcc291397f 100644 --- a/mm/zswap.c +++ b/mm/zswap.c @@ -545,15 +545,11 @@ static void zswap_entry_get(struct zswap_entry *entry) entry->refcount++; } -/* caller must hold the tree lock -* remove from the tree and free it, if nobody reference the entry -*/ +/* caller must hold the tree lock */ static void zswap_entry_put(struct zswap_entry *entry) { - int refcount = --entry->refcount; - - WARN_ON_ONCE(refcount < 0); - if (refcount == 0) { + WARN_ON_ONCE(!entry->refcount); + if (--entry->refcount == 0) { WARN_ON_ONCE(!RB_EMPTY_NODE(&entry->rbnode)); zswap_entry_free(entry); } |