On 8/20/21 3:49 PM, Matthew Wilcox wrote: > 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; Don't really feel that strongly, I tend to like to do the error path like that unless it's a hot path. But I can go either way, if someone else feels strongly about it :-) -- Jens Axboe