linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/exynos: Add check for dma_set_max_seg_size
@ 2024-04-29  2:38 Chen Ni
  2024-04-29  4:36 ` Christoph Hellwig
  0 siblings, 1 reply; 2+ messages in thread
From: Chen Ni @ 2024-04-29  2:38 UTC (permalink / raw)
  To: inki.dae, sw0312.kim, kyungmin.park, airlied, daniel, krzk,
	alim.akhtar, m.szyprowski
  Cc: dri-devel, linux-arm-kernel, linux-samsung-soc, linux-kernel,
	Chen Ni

Add check for the return value of dma_set_max_seg_size() and return
the error if it fails in order to catch the error.

Fixes: ddfd4ab6bb08 ("drm/exynos: Fix dma_parms allocation")
Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
---
 drivers/gpu/drm/exynos/exynos_drm_dma.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_dma.c b/drivers/gpu/drm/exynos/exynos_drm_dma.c
index e2c7373f20c6..0f942186f3ff 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_dma.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_dma.c
@@ -51,7 +51,10 @@ static int drm_iommu_attach_device(struct drm_device *drm_dev,
 		return -EINVAL;
 	}
 
-	dma_set_max_seg_size(subdrv_dev, DMA_BIT_MASK(32));
+	ret = dma_set_max_seg_size(subdrv_dev, DMA_BIT_MASK(32));
+	if (ret)
+		return ret;
+
 	if (IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU)) {
 		/*
 		 * Keep the original DMA mapping of the sub-device and
-- 
2.25.1


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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] drm/exynos: Add check for dma_set_max_seg_size
  2024-04-29  2:38 [PATCH] drm/exynos: Add check for dma_set_max_seg_size Chen Ni
@ 2024-04-29  4:36 ` Christoph Hellwig
  0 siblings, 0 replies; 2+ messages in thread
From: Christoph Hellwig @ 2024-04-29  4:36 UTC (permalink / raw)
  To: Chen Ni
  Cc: inki.dae, sw0312.kim, kyungmin.park, airlied, daniel, krzk,
	alim.akhtar, m.szyprowski, dri-devel, linux-arm-kernel,
	linux-samsung-soc, linux-kernel

On Mon, Apr 29, 2024 at 10:38:33AM +0800, Chen Ni wrote:
> Add check for the return value of dma_set_max_seg_size() and return
> the error if it fails in order to catch the error.
> 
> Fixes: ddfd4ab6bb08 ("drm/exynos: Fix dma_parms allocation")
> Signed-off-by: Chen Ni <nichen@iscas.ac.cn>

With my dma-mapping hat maintainer on I think we should remove the
return value from it.  It can only return -EIO or 0, and the first
only if the bus has not set up a dma_params structure for the device.
I'd much rather WARN_ON() on that, as it is is a grave error to either
call dma_set_max_seg_size on a device that is on a bus that doesn't
support DMA at all, or for the bus maintainer to accidentlaly drop it.

Feel free to add the patch if exynos has a strict error checking policy,
but it's rather pointless and I'll add removing the return value to my
ever growing TODO list.


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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-04-29  4:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-29  2:38 [PATCH] drm/exynos: Add check for dma_set_max_seg_size Chen Ni
2024-04-29  4:36 ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).