Skip to content

Commit e4266f2

Browse files
chuckleveramschuma-ntap
authored andcommitted
xprtrdma: Fix uninitialized variable
net/sunrpc/xprtrdma/frwr_ops.c:151:32: warning: variable 'rc' is uninitialized when used here [-Wuninitialized] trace_xprtrdma_frwr_alloc(mr, rc); ^~ net/sunrpc/xprtrdma/frwr_ops.c:127:8: note: initialize the variable 'rc' to silence this warning int rc; ^ = 0 1 warning generated. The tracepoint is intended to record the error returned from ib_alloc_mr(). In the current code there is no other purpose for @rc, so simply replace it. Reported-by: kernel test robot <[email protected]> Fixes: d8cf39a280c3b0 ('xprtrdma: MR-related memory allocation should be allowed to fail') Signed-off-by: Chuck Lever <[email protected]> Signed-off-by: Anna Schumaker <[email protected]>
1 parent f20f18c commit e4266f2

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

net/sunrpc/xprtrdma/frwr_ops.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,6 @@ int frwr_mr_init(struct rpcrdma_xprt *r_xprt, struct rpcrdma_mr *mr)
124124
unsigned int depth = ep->re_max_fr_depth;
125125
struct scatterlist *sg;
126126
struct ib_mr *frmr;
127-
int rc;
128127

129128
sg = kcalloc_node(depth, sizeof(*sg), XPRTRDMA_GFP_FLAGS,
130129
ibdev_to_node(ep->re_id->device));
@@ -148,7 +147,7 @@ int frwr_mr_init(struct rpcrdma_xprt *r_xprt, struct rpcrdma_mr *mr)
148147

149148
out_mr_err:
150149
kfree(sg);
151-
trace_xprtrdma_frwr_alloc(mr, rc);
150+
trace_xprtrdma_frwr_alloc(mr, PTR_ERR(frmr));
152151
return PTR_ERR(frmr);
153152
}
154153

0 commit comments

Comments
 (0)