[PATCH] iommu/mediatek: fix a reversed test in probe

Yong Wu (吴勇) Yong.Wu at mediatek.com
Sun Mar 26 17:55:38 PDT 2023


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 at gmail.com>

Reviewed-by: Yong Wu <yong.wu at 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
> 


More information about the Linux-mediatek mailing list