Skip to content

Commit

Permalink
fast_get: (cosmetic) reduce the number of gotos
Browse files Browse the repository at this point in the history
Invert a condition to eliminate a single goto.

Signed-off-by: Guennadi Liakhovetski <[email protected]>
  • Loading branch information
lyakh committed Feb 5, 2025
1 parent 506c37c commit 698ac69
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions zephyr/lib/fast-get.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 698ac69

Please sign in to comment.