> Hello Steve Wise, > > The patch 056f9c7f39bf: "iw_cxgb4: dump detailed driver-specific QP > information" from May 3, 2018, leads to the following static checker > warning: > > drivers/infiniband/hw/cxgb4/restrack.c:228 fill_res_qp_entry() > error: uninitialized symbol 'first_sq_idx'. > > drivers/infiniband/hw/cxgb4/restrack.c > 170 static int fill_res_qp_entry(struct sk_buff *msg, > 171 struct rdma_restrack_entry *res) > 172 { > 173 struct ib_qp *ibqp = container_of(res, struct ib_qp, res); > 174 struct t4_swsqe *fsp = NULL, *lsp = NULL; > 175 struct t4_swrqe *frp = NULL, *lrp = NULL; > 176 struct c4iw_qp *qhp = to_c4iw_qp(ibqp); > 177 struct t4_swsqe first_sqe, last_sqe; > 178 struct t4_swrqe first_rqe, last_rqe; > 179 u16 first_sq_idx, last_sq_idx; > ^^^^^^^^^^^^ > 180 u16 first_rq_idx, last_rq_idx; > 181 struct nlattr *table_attr; > 182 struct t4_wq wq; > 183 > 184 /* User qp state is not available, so don't dump user qps */ > 185 if (qhp->ucontext) > 186 return 0; > 187 > 188 table_attr = nla_nest_start(msg, RDMA_NLDEV_ATTR_DRIVER); > 189 if (!table_attr) > 190 goto err; > 191 > 192 /* Get a consistent snapshot */ > 193 spin_lock_irq(&qhp->lock); > 194 wq = qhp->wq; > 195 > 196 /* If there are any pending sqes, copy the first and last */ > 197 if (wq.sq.cidx != wq.sq.pidx) { > 198 first_sq_idx = wq.sq.cidx; > ^^^^^^^^^^^^^^^^^^^^^^^^^ > Only initialized here. > > 199 first_sqe = qhp->wq.sq.sw_sq[first_sq_idx]; > 200 fsp = &first_sqe; > 201 last_sq_idx = wq.sq.pidx; > 202 if (last_sq_idx-- == 0) > 203 last_sq_idx = wq.sq.size - 1; > 204 if (last_sq_idx != first_sq_idx) { > 205 last_sqe = qhp->wq.sq.sw_sq[last_sq_idx]; > 206 lsp = &last_sqe; > 207 } > 208 } > 209 > 210 /* If there are any pending rqes, copy the first and last */ > 211 if (wq.rq.cidx != wq.rq.pidx) { > 212 first_rq_idx = wq.rq.cidx; > 213 first_rqe = qhp->wq.rq.sw_rq[first_rq_idx]; > 214 frp = &first_rqe; > 215 last_rq_idx = wq.rq.pidx; > 216 if (last_rq_idx-- == 0) > 217 last_rq_idx = wq.rq.size - 1; > 218 if (last_rq_idx != first_rq_idx) { > 219 last_rqe = qhp->wq.rq.sw_rq[last_rq_idx]; > 220 lrp = &last_rqe; > 221 } > 222 } > 223 spin_unlock_irq(&qhp->lock); > 224 > 225 if (fill_sq(msg, &wq)) > 226 goto err_cancel_table; > 227 > 228 if (fill_swsqes(msg, &wq.sq, first_sq_idx, fsp, last_sq_idx, lsp)) > ^^^^^^^^^^^^ > On the one hand, it's not a bug to pass uninitialized data when "fsb" is > NULL... Right. If fsp and lsp are NULL then fill_swsqes() doesn't use the idx values. So it is not a bug. But it is an annoying warning. Is it recommended I just initialize these even though they are not needed? Thanks, Steve. -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html