linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/v3d/v3d_drv: Check for error num after setting mask
@ 2022-01-06  2:55 Jiasheng Jiang
  2022-01-06 10:17 ` Melissa Wen
  0 siblings, 1 reply; 3+ messages in thread
From: Jiasheng Jiang @ 2022-01-06  2:55 UTC (permalink / raw)
  To: emma, airlied, daniel, p.zabel; +Cc: dri-devel, linux-kernel, Jiasheng Jiang

Because of the possible failure of the dma_supported(), the
dma_set_mask_and_coherent() may return error num.
Therefore, it should be better to check it and return the error if
fails.

Fixes: 334dd38a3878 ("drm/v3d: Set dma_mask as well as coherent_dma_mask")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
---
 drivers/gpu/drm/v3d/v3d_drv.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/v3d/v3d_drv.c b/drivers/gpu/drm/v3d/v3d_drv.c
index 99e22beea90b..bedd52195723 100644
--- a/drivers/gpu/drm/v3d/v3d_drv.c
+++ b/drivers/gpu/drm/v3d/v3d_drv.c
@@ -232,8 +232,11 @@ static int v3d_platform_drm_probe(struct platform_device *pdev)
 		return ret;
 
 	mmu_debug = V3D_READ(V3D_MMU_DEBUG_INFO);
-	dma_set_mask_and_coherent(dev,
+	ret = dma_set_mask_and_coherent(dev,
 		DMA_BIT_MASK(30 + V3D_GET_FIELD(mmu_debug, V3D_MMU_PA_WIDTH)));
+	if (ret)
+		return ret;
+
 	v3d->va_width = 30 + V3D_GET_FIELD(mmu_debug, V3D_MMU_VA_WIDTH);
 
 	ident1 = V3D_READ(V3D_HUB_IDENT1);
-- 
2.25.1


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

* Re: [PATCH] drm/v3d/v3d_drv: Check for error num after setting mask
  2022-01-06  2:55 [PATCH] drm/v3d/v3d_drv: Check for error num after setting mask Jiasheng Jiang
@ 2022-01-06 10:17 ` Melissa Wen
  2022-01-09 17:34   ` Melissa Wen
  0 siblings, 1 reply; 3+ messages in thread
From: Melissa Wen @ 2022-01-06 10:17 UTC (permalink / raw)
  To: Jiasheng Jiang; +Cc: emma, airlied, daniel, p.zabel, linux-kernel, dri-devel

[-- Attachment #1: Type: text/plain, Size: 1214 bytes --]

On 01/06, Jiasheng Jiang wrote:
> Because of the possible failure of the dma_supported(), the
> dma_set_mask_and_coherent() may return error num.
> Therefore, it should be better to check it and return the error if
> fails.
> 
> Fixes: 334dd38a3878 ("drm/v3d: Set dma_mask as well as coherent_dma_mask")
> Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
> ---
>  drivers/gpu/drm/v3d/v3d_drv.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/v3d/v3d_drv.c b/drivers/gpu/drm/v3d/v3d_drv.c
> index 99e22beea90b..bedd52195723 100644
> --- a/drivers/gpu/drm/v3d/v3d_drv.c
> +++ b/drivers/gpu/drm/v3d/v3d_drv.c
> @@ -232,8 +232,11 @@ static int v3d_platform_drm_probe(struct platform_device *pdev)
>  		return ret;
>  
>  	mmu_debug = V3D_READ(V3D_MMU_DEBUG_INFO);
> -	dma_set_mask_and_coherent(dev,
> +	ret = dma_set_mask_and_coherent(dev,
>  		DMA_BIT_MASK(30 + V3D_GET_FIELD(mmu_debug, V3D_MMU_PA_WIDTH)));
> +	if (ret)
> +		return ret;
> +
lgtm, thanks!

Reviewed-by: Melissa Wen <mwen@igalia.com>

>  	v3d->va_width = 30 + V3D_GET_FIELD(mmu_debug, V3D_MMU_VA_WIDTH);
>  
>  	ident1 = V3D_READ(V3D_HUB_IDENT1);
> -- 
> 2.25.1
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH] drm/v3d/v3d_drv: Check for error num after setting mask
  2022-01-06 10:17 ` Melissa Wen
@ 2022-01-09 17:34   ` Melissa Wen
  0 siblings, 0 replies; 3+ messages in thread
From: Melissa Wen @ 2022-01-09 17:34 UTC (permalink / raw)
  To: Jiasheng Jiang; +Cc: emma, airlied, linux-kernel, dri-devel

[-- Attachment #1: Type: text/plain, Size: 1650 bytes --]

On 01/06, Melissa Wen wrote:
> On 01/06, Jiasheng Jiang wrote:
> > Because of the possible failure of the dma_supported(), the
> > dma_set_mask_and_coherent() may return error num.
> > Therefore, it should be better to check it and return the error if
> > fails.
> > 
> > Fixes: 334dd38a3878 ("drm/v3d: Set dma_mask as well as coherent_dma_mask")
> > Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
> > ---
> >  drivers/gpu/drm/v3d/v3d_drv.c | 5 ++++-
> >  1 file changed, 4 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/gpu/drm/v3d/v3d_drv.c b/drivers/gpu/drm/v3d/v3d_drv.c
> > index 99e22beea90b..bedd52195723 100644
> > --- a/drivers/gpu/drm/v3d/v3d_drv.c
> > +++ b/drivers/gpu/drm/v3d/v3d_drv.c
> > @@ -232,8 +232,11 @@ static int v3d_platform_drm_probe(struct platform_device *pdev)
> >  		return ret;
> >  
> >  	mmu_debug = V3D_READ(V3D_MMU_DEBUG_INFO);
> > -	dma_set_mask_and_coherent(dev,
> > +	ret = dma_set_mask_and_coherent(dev,
> >  		DMA_BIT_MASK(30 + V3D_GET_FIELD(mmu_debug, V3D_MMU_PA_WIDTH)));
> > +	if (ret)
> > +		return ret;
> > +
> lgtm, thanks!
> 
Checkpatch complains when I was about to apply this change.
As the current code already has an alignment issue, here is a good
opportunity to clean it properly. I suggest to create a variable for
the mask to solve this parenthesis alignment issue.

When submitting the next version, add my r-b, please.

Thanks, Melissa

> Reviewed-by: Melissa Wen <mwen@igalia.com>
> 
> >  	v3d->va_width = 30 + V3D_GET_FIELD(mmu_debug, V3D_MMU_VA_WIDTH);
> >  
> >  	ident1 = V3D_READ(V3D_HUB_IDENT1);
> > -- 
> > 2.25.1
> > 



[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

end of thread, other threads:[~2022-01-09 17:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-06  2:55 [PATCH] drm/v3d/v3d_drv: Check for error num after setting mask Jiasheng Jiang
2022-01-06 10:17 ` Melissa Wen
2022-01-09 17:34   ` Melissa Wen

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).