RE: [PATCH rdma-next 4/6] RDMA/mana_ib: introduce a helper to remove cq callbacks

Long Li
2024-04-25T20:29:48Z

> > > +void mana_ib_remove_cq_cb(struct mana_ib_dev *mdev, struct
> > > mana_ib_cq
> > > +*cq) {
> > > + struct gdma_context *gc = mdev_to_gc(mdev);
> > > +
> > > + if (cq->queue.id >= gc->max_num_cqs)
> > > + return;
> > > +
> > > + kfree(gc->cq_table[cq->queue.id]);
> > > + gc->cq_table[cq->queue.id] = NULL;
> >
> > Why the check for (cq->queue.id != INVALID_QUEUE_ID) is removed?
>
> As max_num_cqs is always less than INVALID_QUEUE_ID, it is included in the "if".
> I can add " || cq->queue.id == INVALID_QUEUE_ID " to the condition if you want.

Okay, can you add a comment before if (cq->queue.id >= gc->max_num_cqs) saying it also works with INVALID_QUEUE_ID?