Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fe274c5a authored by Insu Yun's avatar Insu Yun Committed by Doug Ledford
Browse files

usnic: correctly handle kzalloc return value



Since kzalloc returns memory address, not error code,
it should be checked whether it is null or not.

Signed-off-by: default avatarInsu Yun <wuninsu@gmail.com>
Reviewed-by: default avatarDave Goodell <dgoodell@cisco.com>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent 35ef4a9e
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -236,8 +236,8 @@ create_roce_custom_flow(struct usnic_ib_qp_grp *qp_grp,

	/* Create Flow Handle */
	qp_flow = kzalloc(sizeof(*qp_flow), GFP_ATOMIC);
	if (IS_ERR_OR_NULL(qp_flow)) {
		err = qp_flow ? PTR_ERR(qp_flow) : -ENOMEM;
	if (!qp_flow) {
		err = -ENOMEM;
		goto out_dealloc_flow;
	}
	qp_flow->flow = flow;
@@ -311,8 +311,8 @@ create_udp_flow(struct usnic_ib_qp_grp *qp_grp,

	/* Create qp_flow */
	qp_flow = kzalloc(sizeof(*qp_flow), GFP_ATOMIC);
	if (IS_ERR_OR_NULL(qp_flow)) {
		err = qp_flow ? PTR_ERR(qp_flow) : -ENOMEM;
	if (!qp_flow) {
		err = -ENOMEM;
		goto out_dealloc_flow;
	}
	qp_flow->flow = flow;