diff mbox series

[v2,for-next,4/4] IB/hfi1: Missing return value in error path for user sdma

Message ID 20180910163925.23326.9621.stgit@scvm10.sc.intel.com (mailing list archive)
State Accepted
Delegated to: Jason Gunthorpe
Headers show
Series IB/hfi1: Updates and fixes for user SDMA | expand

Commit Message

Dennis Dalessandro Sept. 10, 2018, 4:39 p.m. UTC
From: Michael J. Ruhl <michael.j.ruhl@intel.com>

If the set_txreq_header_agh() function returns an error, the exit path
is chosen.

In this path, the code fails to set the return value.  This will cause
the caller to not realize an error has occurred.

Set the return value correctly in the error path.

Signed-off-by: Michael J. Ruhl <michael.j.ruhl@intel.com>
Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
---
 drivers/infiniband/hw/hfi1/user_sdma.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
diff mbox series

Patch

diff --git a/drivers/infiniband/hw/hfi1/user_sdma.c b/drivers/infiniband/hw/hfi1/user_sdma.c
index bee75be..825e475 100644
--- a/drivers/infiniband/hw/hfi1/user_sdma.c
+++ b/drivers/infiniband/hw/hfi1/user_sdma.c
@@ -860,8 +860,10 @@  static int user_sdma_send_pkts(struct user_sdma_request *req, u16 maxpkts)
 
 				changes = set_txreq_header_ahg(req, tx,
 							       datalen);
-				if (changes < 0)
+				if (changes < 0) {
+					ret = changes;
 					goto free_tx;
+				}
 			}
 		} else {
 			ret = sdma_txinit(&tx->txreq, 0, sizeof(req->hdr) +