Re: [PATCH v1 1/1] spi: Remove unneded check for orig_nents

From: Andy Shevchenko
Date: Thu May 16 2024 - 06:18:20 EST


On Wed, May 15, 2024 at 05:09:33PM -0400, Nícolas F. R. A. Prado wrote:
> On Tue, May 07, 2024 at 11:10:27PM +0300, Andy Shevchenko wrote:
> > Both dma_unmap_sgtable() and sg_free_table() in spi_unmap_buf_attrs()
> > have checks for orig_nents against 0. No need to duplicate this.
> > All the same applies to other DMA mapping API calls.
> >
> > Also note, there is no other user in the kernel that does this kind of
> > checks.
> >
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
>
> this commit caused a regression which I reported here:
>
> https://lore.kernel.org/all/d3679496-2e4e-4a7c-97ed-f193bd53af1d@notapiano
>
> along with some thoughts on the cause and a possible solution, though I'm not
> familiar with this code base at all and would really appreciate any feedback you
> may have.

Thanks for the report and preliminary analysis!
I'll look at it hopefully sooner than later.

But at least what I think now is that my change revealed a problem somewhere
else, because that's how DMA mapping / streaming APIs designed, it's extremely
rare to check orig_nents field.

--
With Best Regards,
Andy Shevchenko