On Fri, Aug 20, 2021 at 03:01:20PM -0600, Jens Axboe wrote: > ret = xa_alloc_cyclic(&ctx->personalities, &id, (void *)creds, > XA_LIMIT(0, USHRT_MAX), &ctx->pers_next, GFP_KERNEL); > - if (!ret) > - return id; > - put_cred(creds); > - return ret; > + if (ret < 0) { > + put_cred(creds); > + return ret; > + } > + return id; > } Wouldn't you rather: if (ret >= 0) return id; put_cred(creds); return ret; ?