All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iommu/mediatek: fix a reversed test in probe
@ 2023-03-25 11:07 Dan Carpenter
  2023-03-27  0:55 ` Yong Wu (吴勇)
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Dan Carpenter @ 2023-03-25 11:07 UTC (permalink / raw)
  To: Yong Wu
  Cc: Joerg Roedel, Will Deacon, Robin Murphy, Matthias Brugger,
	AngeloGioacchino Del Regno, Chengci.Xu, iommu, linux-mediatek,
	kernel-janitors

The dma_set_mask() function returns negative error codes on failure but
this code is testing for zero instead.

Fixes: f4b49c7c5e67 ("iommu/mediatek: Set dma_mask for PGTABLE_PA_35_EN")
Signed-off-by: Dan Carpenter <error27@gmail.com>
---
 drivers/iommu/mtk_iommu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c
index 1a75b4382a92..6a00ce208dc2 100644
--- a/drivers/iommu/mtk_iommu.c
+++ b/drivers/iommu/mtk_iommu.c
@@ -1260,7 +1260,7 @@ static int mtk_iommu_probe(struct platform_device *pdev)
 
 	if (MTK_IOMMU_HAS_FLAG(data->plat_data, PGTABLE_PA_35_EN)) {
 		ret = dma_set_mask(dev, DMA_BIT_MASK(35));
-		if (!ret) {
+		if (ret) {
 			dev_err(dev, "Failed to set dma_mask 35.\n");
 			return ret;
 		}
-- 
2.39.1


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

* Re: [PATCH] iommu/mediatek: fix a reversed test in probe
  2023-03-25 11:07 [PATCH] iommu/mediatek: fix a reversed test in probe Dan Carpenter
@ 2023-03-27  0:55 ` Yong Wu (吴勇)
  2023-03-27  7:49 ` AngeloGioacchino Del Regno
  2023-03-28 13:28 ` Joerg Roedel
  2 siblings, 0 replies; 4+ messages in thread
From: Yong Wu (吴勇) @ 2023-03-27  0:55 UTC (permalink / raw)
  To: error27
  Cc: kernel-janitors, linux-mediatek, robin.murphy, joro,
	Chengci Xu (许承赐),
	iommu, matthias.bgg, angelogioacchino.delregno, will

On Sat, 2023-03-25 at 14:07 +0300, Dan Carpenter wrote:
> 
> The dma_set_mask() function returns negative error codes on failure
> but
> this code is testing for zero instead.
> 
> Fixes: f4b49c7c5e67 ("iommu/mediatek: Set dma_mask for
> PGTABLE_PA_35_EN")
> Signed-off-by: Dan Carpenter <error27@gmail.com>

Reviewed-by: Yong Wu <yong.wu@mediatek.com>

Thanks for the help.

> ---
>  drivers/iommu/mtk_iommu.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c
> index 1a75b4382a92..6a00ce208dc2 100644
> --- a/drivers/iommu/mtk_iommu.c
> +++ b/drivers/iommu/mtk_iommu.c
> @@ -1260,7 +1260,7 @@ static int mtk_iommu_probe(struct
> platform_device *pdev)
> 
>         if (MTK_IOMMU_HAS_FLAG(data->plat_data, PGTABLE_PA_35_EN)) {
>                 ret = dma_set_mask(dev, DMA_BIT_MASK(35));
> -               if (!ret) {
> +               if (ret) {
>                         dev_err(dev, "Failed to set dma_mask 35.\n");
>                         return ret;
>                 }
> --
> 2.39.1
> 

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

* Re: [PATCH] iommu/mediatek: fix a reversed test in probe
  2023-03-25 11:07 [PATCH] iommu/mediatek: fix a reversed test in probe Dan Carpenter
  2023-03-27  0:55 ` Yong Wu (吴勇)
@ 2023-03-27  7:49 ` AngeloGioacchino Del Regno
  2023-03-28 13:28 ` Joerg Roedel
  2 siblings, 0 replies; 4+ messages in thread
From: AngeloGioacchino Del Regno @ 2023-03-27  7:49 UTC (permalink / raw)
  To: Dan Carpenter, Yong Wu
  Cc: Joerg Roedel, Will Deacon, Robin Murphy, Matthias Brugger,
	Chengci.Xu, iommu, linux-mediatek, kernel-janitors

Il 25/03/23 12:07, Dan Carpenter ha scritto:
> The dma_set_mask() function returns negative error codes on failure but
> this code is testing for zero instead.
> 
> Fixes: f4b49c7c5e67 ("iommu/mediatek: Set dma_mask for PGTABLE_PA_35_EN")
> Signed-off-by: Dan Carpenter <error27@gmail.com>

Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>



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

* Re: [PATCH] iommu/mediatek: fix a reversed test in probe
  2023-03-25 11:07 [PATCH] iommu/mediatek: fix a reversed test in probe Dan Carpenter
  2023-03-27  0:55 ` Yong Wu (吴勇)
  2023-03-27  7:49 ` AngeloGioacchino Del Regno
@ 2023-03-28 13:28 ` Joerg Roedel
  2 siblings, 0 replies; 4+ messages in thread
From: Joerg Roedel @ 2023-03-28 13:28 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Yong Wu, Will Deacon, Robin Murphy, Matthias Brugger,
	AngeloGioacchino Del Regno, Chengci.Xu, iommu, linux-mediatek,
	kernel-janitors

On Sat, Mar 25, 2023 at 02:07:52PM +0300, Dan Carpenter wrote:
> The dma_set_mask() function returns negative error codes on failure but
> this code is testing for zero instead.
> 
> Fixes: f4b49c7c5e67 ("iommu/mediatek: Set dma_mask for PGTABLE_PA_35_EN")
> Signed-off-by: Dan Carpenter <error27@gmail.com>
> ---
>  drivers/iommu/mtk_iommu.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Thanks for the fix, but I replaced above commit with v3, which I
overlooked when applying it. The v3 post has this already fixed.

Regards,

	Joerg

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

end of thread, other threads:[~2023-03-28 13:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-25 11:07 [PATCH] iommu/mediatek: fix a reversed test in probe Dan Carpenter
2023-03-27  0:55 ` Yong Wu (吴勇)
2023-03-27  7:49 ` AngeloGioacchino Del Regno
2023-03-28 13:28 ` Joerg Roedel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.