Commit c5f42b21 authored by Gal Pressman's avatar Gal Pressman Committed by Jason Gunthorpe

RDMA/core: Check for error instead of success in alloc MR function

The common kernel pattern is to check for error, not success.  Flip the if
statement accordingly and keep the main flow unindented.

Link: https://lore.kernel.org/r/20200706120343.10816-2-galpress@amazon.comSigned-off-by: default avatarGal Pressman <galpress@amazon.com>
Reviewed-by: default avatarLeon Romanovsky <leonro@mellanox.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
parent c367124e
...@@ -2133,7 +2133,9 @@ struct ib_mr *ib_alloc_mr_user(struct ib_pd *pd, enum ib_mr_type mr_type, ...@@ -2133,7 +2133,9 @@ struct ib_mr *ib_alloc_mr_user(struct ib_pd *pd, enum ib_mr_type mr_type,
} }
mr = pd->device->ops.alloc_mr(pd, mr_type, max_num_sg, udata); mr = pd->device->ops.alloc_mr(pd, mr_type, max_num_sg, udata);
if (!IS_ERR(mr)) { if (IS_ERR(mr))
goto out;
mr->device = pd->device; mr->device = pd->device;
mr->pd = pd; mr->pd = pd;
mr->dm = NULL; mr->dm = NULL;
...@@ -2144,7 +2146,6 @@ struct ib_mr *ib_alloc_mr_user(struct ib_pd *pd, enum ib_mr_type mr_type, ...@@ -2144,7 +2146,6 @@ struct ib_mr *ib_alloc_mr_user(struct ib_pd *pd, enum ib_mr_type mr_type,
rdma_restrack_kadd(&mr->res); rdma_restrack_kadd(&mr->res);
mr->type = mr_type; mr->type = mr_type;
mr->sig_attrs = NULL; mr->sig_attrs = NULL;
}
out: out:
trace_mr_alloc(pd, mr_type, max_num_sg, mr); trace_mr_alloc(pd, mr_type, max_num_sg, mr);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment