Re: [PATCH 03/17] RDMA/core: Introduce IB_MR_TYPE_PI and ib_alloc_mr_integrity API

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 2/5/2019 6:28 AM, Jason Gunthorpe wrote:
On Mon, Feb 04, 2019 at 08:26:48PM -0800, Bart Van Assche wrote:
On 2/4/19 9:50 AM, Max Gurtovoy wrote:
+struct ib_mr *ib_alloc_mr_integrity(struct ib_pd *pd,
+				    u32 max_num_data_sg,
+				    u32 max_num_meta_sg)
+{
+	struct ib_mr *mr;
+
+	if (!pd->device->ops.alloc_mr_integrity)
+		return ERR_PTR(-EOPNOTSUPP);
+
+	if (!max_num_meta_sg)
+		return ERR_PTR(-EINVAL);
+
+	mr = pd->device->ops.alloc_mr_integrity(pd, max_num_data_sg,
+						max_num_meta_sg);
+	if (!IS_ERR(mr)) {
+		mr->device  = pd->device;
+		mr->pd      = pd;
+		mr->dm      = NULL;
+		mr->uobject = NULL;
+		atomic_inc(&pd->usecnt);
+		mr->need_inval = false;
+		mr->res.type = RDMA_RESTRACK_MR;
+		rdma_restrack_kadd(&mr->res);
+		mr->type = IB_MR_TYPE_PI;
+	}
+
+	return mr;
+}
Please use the traditional Linux kernel coding style, namely if (IS_ERR(mr))
return mr; instead of the above.
And don't randomly indent some ='s but not others. Just forget about
horizontal alignment :(

Jason

Sure no problem doing that. JFYI, this coding style was taken from ib_alloc_mr.

I guess we can fix that too in a separate commit.




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux