[PATCH 1/4] drm/sti: check dma_set_coherent_mask return value

Raphael Gallais-Pou posted 4 patches 2 months, 2 weeks ago
[PATCH 1/4] drm/sti: check dma_set_coherent_mask return value
Posted by Raphael Gallais-Pou 2 months, 2 weeks ago
Return value for DMA allocation was not checked.  Check it and return
error code in case of failing.

Signed-off-by: Raphael Gallais-Pou <rgallaispou@gmail.com>
---
 drivers/gpu/drm/sti/sti_drv.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/sti/sti_drv.c b/drivers/gpu/drm/sti/sti_drv.c
index 5e9332df21df0db30f10b7a6f5a41cba85c4f7ae..42f21ab91957b38cb9aef012b6ee7f4ae1683edf 100644
--- a/drivers/gpu/drm/sti/sti_drv.c
+++ b/drivers/gpu/drm/sti/sti_drv.c
@@ -234,8 +234,11 @@ static int sti_platform_probe(struct platform_device *pdev)
 	struct device_node *node = dev->of_node;
 	struct device_node *child_np;
 	struct component_match *match = NULL;
+	int ret;
 
-	dma_set_coherent_mask(dev, DMA_BIT_MASK(32));
+	ret = dma_set_coherent_mask(dev, DMA_BIT_MASK(32));
+	if (ret)
+		return ret;
 
 	devm_of_platform_populate(dev);
 

-- 
2.50.1
Re: [PATCH 1/4] drm/sti: check dma_set_coherent_mask return value
Posted by Alain Volmat 3 weeks, 3 days ago
Hi Raphael,

Thank you for this patch.

On Thu, Jul 17, 2025 at 09:15:32PM +0200, Raphael Gallais-Pou wrote:
> Return value for DMA allocation was not checked.  Check it and return
> error code in case of failing.
> 
> Signed-off-by: Raphael Gallais-Pou <rgallaispou@gmail.com>
> ---
>  drivers/gpu/drm/sti/sti_drv.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/sti/sti_drv.c b/drivers/gpu/drm/sti/sti_drv.c
> index 5e9332df21df0db30f10b7a6f5a41cba85c4f7ae..42f21ab91957b38cb9aef012b6ee7f4ae1683edf 100644
> --- a/drivers/gpu/drm/sti/sti_drv.c
> +++ b/drivers/gpu/drm/sti/sti_drv.c
> @@ -234,8 +234,11 @@ static int sti_platform_probe(struct platform_device *pdev)
>  	struct device_node *node = dev->of_node;
>  	struct device_node *child_np;
>  	struct component_match *match = NULL;
> +	int ret;
>  
> -	dma_set_coherent_mask(dev, DMA_BIT_MASK(32));
> +	ret = dma_set_coherent_mask(dev, DMA_BIT_MASK(32));
> +	if (ret)
> +		return ret;
>  
>  	devm_of_platform_populate(dev);
>  
>
> -- 
> 2.50.1
> 

Acked-by: Alain Volmat <alain.volmat@foss.st.com>

Best regards
Alain