c
struct npc_mcam {
    // ...
    struct kref counters_bmap_ref;
    void *counters_bmap;
    // ...
};

void rvu_npc_freemem(struct rvu *rvu)
{
    // ...
    if (!kref_put(&mcam->counters_bmap_ref, npc_mcam_bmap_release)) {
        kfree(mcam->counters_bmap);
    }
    // ...
}

void npc_mcam_bmap_release(struct kref *ref)
{
    struct npc_mcam *mcam = container_of(ref, struct npc_mcam, counters_bmap_ref);
    kfree(mcam->counters_bmap);
}
