On Sat, Oct 29, 2016 at 05:03:42PM +0800, Lijun Ou wrote: > This patch mainly introduces the verbs with pd and mr, > included alloc_pd, dealloc_pd, reg_mr and dereg_mr. > > Signed-off-by: Lijun Ou <oulijun@xxxxxxxxxx> > Signed-off-by: Wei Hu <xavier.huwei@xxxxxxxxxx> > --- > v2: > - No change over v1 > > v1: > - The initial submit > --- > providers/hns/hns_roce_u.c | 4 ++ > providers/hns/hns_roce_u.h | 18 +++++++++ > providers/hns/hns_roce_u_abi.h | 6 +++ > providers/hns/hns_roce_u_verbs.c | 79 ++++++++++++++++++++++++++++++++++++++++ > 4 files changed, 107 insertions(+) <....> > +struct ibv_mr *hns_roce_u_reg_mr(struct ibv_pd *pd, void *addr, size_t length, > + int access) > +{ > + int ret; > + struct ibv_mr *mr; > + struct ibv_reg_mr cmd; > + struct ibv_reg_mr_resp resp; > + > + if (addr == NULL) { It can be great if you use one style for all your code e.g. if(!addr) .... > + fprintf(stderr, "2nd parm addr is NULL!\n"); > + return NULL; > + } > + > + if (length == 0) { > + fprintf(stderr, "3st parm length is 0!\n"); > + return NULL; > + } > + > + mr = malloc(sizeof(*mr)); > + if (mr) > + return NULL; It looks like bug and you wanted if(!mr) and not if(mr).
Attachment:
signature.asc
Description: PGP signature