On Fri, Jul 06, 2018 at 10:28:27AM -0700, Bart Van Assche wrote: > Introduce the function __c4iw_poll_cq_one() such that c4iw_poll_cq_one() > becomes easier to analyze for static source code analyzers. This patch > avoids that sparse reports the following: > > drivers/infiniband/hw/cxgb4/cq.c:401:36: warning: context imbalance in 'c4iw_flush_hw_cq' - unexpected unlock > drivers/infiniband/hw/cxgb4/cq.c:824:9: warning: context imbalance in 'c4iw_poll_cq_one' - different lock contexts for basic block > > Compile-tested only. > > Signed-off-by: Bart Van Assche <bart.vanassche@xxxxxxx> > Cc: Steve Wise <swise@xxxxxxxxxxx> > drivers/infiniband/hw/cxgb4/cq.c | 62 ++++++++++++++++++-------------- > 1 file changed, 35 insertions(+), 27 deletions(-) > > diff --git a/drivers/infiniband/hw/cxgb4/cq.c b/drivers/infiniband/hw/cxgb4/cq.c > index 2be2e1ac1b5f..8426e74c6964 100644 > +++ b/drivers/infiniband/hw/cxgb4/cq.c > @@ -668,43 +668,22 @@ static int poll_cq(struct t4_wq *wq, struct t4_cq *cq, struct t4_cqe *cqe, > return ret; > } > > -/* > - * Get one cq entry from c4iw and map it to openib. > - * > - * Returns: > - * 0 cqe returned > - * -ENODATA EMPTY; > - * -EAGAIN caller must try again > - * any other -errno fatal error > - */ > -static int c4iw_poll_cq_one(struct c4iw_cq *chp, struct ib_wc *wc) > +static int __c4iw_poll_cq_one(struct c4iw_cq *chp, struct c4iw_qp *qhp, > + struct ib_wc *wc) > { > - struct c4iw_qp *qhp = NULL; > - struct t4_cqe uninitialized_var(cqe), *rd_cqe; > - struct t4_wq *wq; > + struct t4_cqe uninitialized_var(cqe); This uninitialized_var isn't needed these days > > @@ -819,8 +798,37 @@ static int c4iw_poll_cq_one(struct c4iw_cq *chp, struct ib_wc *wc) > } > } > out: > - if (wq) > + return ret; > +} > + > +/* > + * Get one cq entry from c4iw and map it to openib. > + * > + * Returns: > + * 0 cqe returned > + * -ENODATA EMPTY; > + * -EAGAIN caller must try again > + * any other -errno fatal error > + */ > +static int c4iw_poll_cq_one(struct c4iw_cq *chp, struct ib_wc *wc) > +{ > + struct c4iw_qp *qhp = NULL; > + struct t4_cqe uninitialized_var(cqe), *rd_cqe; > + int ret; 'cqe' is not used in the function. I made these two changes and applied it to for-next Jason -- 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