Re: [PATCH 2/2] RDMA: dma-mapping: Return an unsigned int from ib_dma_map_sg{,_attrs}

From: Leon Romanovsky
Date: Mon Aug 29 2022 - 08:23:51 EST


On Mon, Aug 29, 2022 at 11:40:40AM +0200, Jinpu Wang wrote:
> On Sun, Aug 28, 2022 at 1:09 PM Leon Romanovsky <leon@xxxxxxxxxx> wrote:
> >
> > On Fri, Aug 26, 2022 at 11:56:15AM +0200, Jack Wang wrote:
> > > Following 2a047e0662ae ("dma-mapping: return an unsigned int from dma_map_sg{,_attrs}")
> > > change the return value of ib_dma_map_sg{,attrs} to unsigned int.
> > >
> > > Cc: Jason Gunthorpe <jgg@xxxxxxxx>
> > > Cc: Leon Romanovsky <leon@xxxxxxxxxx>
> > > Cc: Christoph Hellwig <hch@xxxxxx>
> > > Cc: linux-rdma@xxxxxxxxxxxxxxx
> > > Cc: linux-kernel@xxxxxxxxxxxxxxx
> > >
> > > Signed-off-by: Jack Wang <jinpu.wang@xxxxxxxxx>
> > > ---
> > > drivers/infiniband/core/device.c | 2 +-
> > > include/rdma/ib_verbs.h | 6 +++---
> > > 2 files changed, 4 insertions(+), 4 deletions(-)
> >
> > You forgot to change ib_dma_map_sgtable_attrs() and various
> > ib_dma_map_sg*() callers.
> No, they are different.
> ib_dma_map_sgtable_attrs and dma_map_sgtable return negative on errors.

It is not the point. You changed ib_dma_virt_map_sg() to be unsigned,
so now the following lines are not correct:

4138 int nents;
4139
4140 if (ib_uses_virt_dma(dev)) {
4141 nents = ib_dma_virt_map_sg(dev, sgt->sgl, sgt->orig_nents);

"int nents" should be changed to "unsigned int".

Thanks

> >
> > Thanks
> Thanks!