Re: [PATCH v1 08/11] media: intel/ipu6: return an error from ipu6_dma_map_sgtable() on failure
From: Valerii Sokolov
Date: Tue Nov 03 2026 - 16:04:03 EST
Hi Sakari,
On Sat, Oct 31, 2026 at 12:45:34AM +0200, Sakari Ailus wrote:
> Hi Valerii,
>
> Thank you for the set. These are really nice fixes!
>
> On Fri, Oct 23, 2026 at 07:55:58PM +0000, Valerii Sokolov wrote:
> > @@ -459,8 +459,8 @@ int ipu6_dma_map_sgtable(struct ipu6_bus_device *sys, struct sg_table *sgt,
> > int nents;
> >
> > nents = ipu6_dma_map_sg(sys, sgt->sgl, sgt->nents, dir, attrs);
> > - if (nents < 0)
> > - return nents;
> > + if (nents <= 0)
> > + return nents < 0 ? nents : -ENOMEM;
>
> I think this has been written as-is since the thinking has been a negative
> error code is returned on error. So I'd fix this on ipu6_dma_map_sg() side
> instead.
>
> dma_map_sg() returns 0 on error (which is probably the source of this
> discrepancy) but I don't think we need to align the error codes to that.
Good point -- ipu6_dma_map_sg() already returns -EFAULT and -ENOMEM on
its earlier error paths. I have updated patch 8/11 to propagate the
negative error code from ipu6_mmu_map() in ipu6_dma_map_sg() for v2.
Best regards,
Valerii