* [PATCH] drm/panfrost: Check for error num after setting mask
@ 2022-01-06 3:03 Jiasheng Jiang
2022-01-12 15:46 ` Steven Price
0 siblings, 1 reply; 2+ messages in thread
From: Jiasheng Jiang @ 2022-01-06 3:03 UTC (permalink / raw)
To: robh, tomeu.vizoso, steven.price, alyssa.rosenzweig, airlied, daniel
Cc: Jiasheng Jiang, linux-kernel, dri-devel
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: d9b631f0a0c4 ("drm/panfrost: Set DMA masks earlier")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
---
drivers/gpu/drm/panfrost/panfrost_gpu.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/panfrost/panfrost_gpu.c b/drivers/gpu/drm/panfrost/panfrost_gpu.c
index 2aae636f1cf5..107ad2d764ec 100644
--- a/drivers/gpu/drm/panfrost/panfrost_gpu.c
+++ b/drivers/gpu/drm/panfrost/panfrost_gpu.c
@@ -359,8 +359,11 @@ int panfrost_gpu_init(struct panfrost_device *pfdev)
panfrost_gpu_init_features(pfdev);
- dma_set_mask_and_coherent(pfdev->dev,
+ err = dma_set_mask_and_coherent(pfdev->dev,
DMA_BIT_MASK(FIELD_GET(0xff00, pfdev->features.mmu_features)));
+ if (err)
+ return err;
+
dma_set_max_seg_size(pfdev->dev, UINT_MAX);
irq = platform_get_irq_byname(to_platform_device(pfdev->dev), "gpu");
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] drm/panfrost: Check for error num after setting mask
2022-01-06 3:03 [PATCH] drm/panfrost: Check for error num after setting mask Jiasheng Jiang
@ 2022-01-12 15:46 ` Steven Price
0 siblings, 0 replies; 2+ messages in thread
From: Steven Price @ 2022-01-12 15:46 UTC (permalink / raw)
To: Jiasheng Jiang, robh, tomeu.vizoso, alyssa.rosenzweig, airlied, daniel
Cc: linux-kernel, dri-devel
On 06/01/2022 03:03, 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: d9b631f0a0c4 ("drm/panfrost: Set DMA masks earlier")
That commit just moved the code around, the actual missing error
handling dates from the very beginning (f3ba91228e8e ("drm/panfrost: Add
initial panfrost driver")). But I can fix that up when merging.
> Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Reviewed-by: Steven Price <steven.price@arm.com>
Thanks,
Steve
> ---
> drivers/gpu/drm/panfrost/panfrost_gpu.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/panfrost/panfrost_gpu.c b/drivers/gpu/drm/panfrost/panfrost_gpu.c
> index 2aae636f1cf5..107ad2d764ec 100644
> --- a/drivers/gpu/drm/panfrost/panfrost_gpu.c
> +++ b/drivers/gpu/drm/panfrost/panfrost_gpu.c
> @@ -359,8 +359,11 @@ int panfrost_gpu_init(struct panfrost_device *pfdev)
>
> panfrost_gpu_init_features(pfdev);
>
> - dma_set_mask_and_coherent(pfdev->dev,
> + err = dma_set_mask_and_coherent(pfdev->dev,
> DMA_BIT_MASK(FIELD_GET(0xff00, pfdev->features.mmu_features)));
> + if (err)
> + return err;
> +
> dma_set_max_seg_size(pfdev->dev, UINT_MAX);
>
> irq = platform_get_irq_byname(to_platform_device(pfdev->dev), "gpu");
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-01-12 15:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-06 3:03 [PATCH] drm/panfrost: Check for error num after setting mask Jiasheng Jiang
2022-01-12 15:46 ` Steven Price
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).