From 698ac6908aac7f4c21dad2f8902a0d0376a13e17 Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Wed, 5 Feb 2025 17:06:48 +0100 Subject: [PATCH] fast_get: (cosmetic) reduce the number of gotos Invert a condition to eliminate a single goto. Signed-off-by: Guennadi Liakhovetski --- zephyr/lib/fast-get.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/zephyr/lib/fast-get.c b/zephyr/lib/fast-get.c index f39396b3d654..abf5c2b94df0 100644 --- a/zephyr/lib/fast-get.c +++ b/zephyr/lib/fast-get.c @@ -159,10 +159,10 @@ void fast_put(const void *sram_ptr) goto out; } entry->refcount--; - if (entry->refcount > 0) - goto out; - rfree(entry->sram_ptr); - memset(entry, 0, sizeof(*entry)); + if (!entry->refcount) { + rfree(entry->sram_ptr); + memset(entry, 0, sizeof(*entry)); + } out: tr_dbg(fast_get, "put %p, DRAM %p size %u refcnt %u", sram_ptr, entry ? entry->dram_ptr : 0, entry ? entry->size : 0, entry ? entry->refcount : 0);