From: Johannes Weiner Date: Tue, 30 Jan 2024 01:36:41 +0000 (-0500) Subject: mm: zswap: clean up zswap_entry_put() X-Git-Tag: v6.9-rc1~107^2~370 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dab7711fac6dd3c45471bfb3b6b5336e8fa900a2;p=thirdparty%2Fkernel%2Flinux.git 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 Acked-by: Yosry Ahmed Reviewed-by: Nhat Pham Reviewed-by: Chengming Zhou Signed-off-by: Andrew Morton --- diff --git a/mm/zswap.c b/mm/zswap.c index 70e409add32b2..32bcc291397ff 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); }