# Re: \[PATCH v1 16/16\] dma-mapping: Disallow .map\_sg operations from returning zero on error

- From: Christoph Hellwig \<hch@lst.de\>
- Date: 2021-07-16 06:33:37 
- List: linux-arm-kernel
- Page: https://ratatoskr.run/linux-arm-kernel/2021/07/1447218
- Thread: https://ratatoskr.run/linux-alpha/2021/07/1445836/t.md

```text
On Thu, Jul 15, 2021 at 10:45:44AM -0600, Logan Gunthorpe wrote:
> @@ -194,6 +194,8 @@ static int __dma_map_sg_attrs(struct device *dev, struct scatterlist *sg,
>  	else
>  		ents = ops->map_sg(dev, sg, nents, dir, attrs);
>  
> +	WARN_ON_ONCE(ents == 0);

Turns this into a negative error code while we're at it, just to keep
the callers sane?

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
```
