[PATCH] iw_cxgb4: fix uninitialized variable plen

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

 



Fixes the following smatch warning and few more possible cases:
The patch 94245f4ad9e1: "iw_cxgb4: Support FW write completion WR"
from Aug 2, 2018, leads to the following static checker warning:

	drivers/infiniband/hw/cxgb4/qp.c:651 build_rdma_write_cmpl()
	error: uninitialized symbol 'plen'.

Fixes: 94245f4ad9e ("iw_cxgb4: Support FW write completion WR")
Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
Signed-off-by: Potnuri Bharat Teja <bharat@xxxxxxxxxxx>
---
 drivers/infiniband/hw/cxgb4/qp.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/infiniband/hw/cxgb4/qp.c b/drivers/infiniband/hw/cxgb4/qp.c
index b3203afa3b1d..c625d94db038 100644
--- a/drivers/infiniband/hw/cxgb4/qp.c
+++ b/drivers/infiniband/hw/cxgb4/qp.c
@@ -487,7 +487,7 @@ static int build_isgl(__be64 *queue_start, __be64 *queue_end,
 static int build_rdma_send(struct t4_sq *sq, union t4_wr *wqe,
 			   const struct ib_send_wr *wr, u8 *len16)
 {
-	u32 plen;
+	u32 plen = 0;
 	int size;
 	int ret;
 
@@ -519,7 +519,6 @@ static int build_rdma_send(struct t4_sq *sq, union t4_wr *wqe,
 	wqe->send.r3 = 0;
 	wqe->send.r4 = 0;
 
-	plen = 0;
 	if (wr->num_sge) {
 		if (wr->send_flags & IB_SEND_INLINE) {
 			ret = build_immd(sq, wqe->send.u.immd_src, wr,
@@ -554,7 +553,7 @@ static int build_rdma_send(struct t4_sq *sq, union t4_wr *wqe,
 static int build_rdma_write(struct t4_sq *sq, union t4_wr *wqe,
 			    const struct ib_send_wr *wr, u8 *len16)
 {
-	u32 plen;
+	u32 plen = 0;
 	int size;
 	int ret;
 
@@ -615,7 +614,7 @@ static void build_rdma_write_cmpl(struct t4_sq *sq,
 				  struct fw_ri_rdma_write_cmpl_wr *wcwr,
 				  const struct ib_send_wr *wr, u8 *len16)
 {
-	u32 plen;
+	u32 plen = 0;
 	int size;
 
 	/*
-- 
2.18.0.232.gb7bd9486b055




[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