iommu/mediatek: Fix handling of of_count_phandle_with_args result

Author: Andrzej Hajda <a.hajda@samsung.com>

The function can return negative value so it should be assigned to signed
variable. The patch changes also type of related i variable to make code
more compact and coherent.

The problem has been detected using patch
scripts/coccinelle/tests/unsigned_lesser_than_zero.cocci.

Signed-off-by: Andrzej Hajda 
Signed-off-by: Joerg Roedel 
---
 drivers/iommu/mtk_iommu.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
 
diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c
index f3c160e..4b9ae64 100644
--- a/drivers/iommu/mtk_iommu.c
+++ b/drivers/iommu/mtk_iommu.c
@@ -578,8 +578,7 @@ static int mtk_iommu_probe(struct platform_device *pdev)
 	struct resource         *res;
 	struct component_match  *match = NULL;
 	void                    *protect;
-	unsigned int            i, larb_nr;
-	int                     ret;
+	int                     i, larb_nr, ret;
 
 	data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
 	if (!data)
BtrLinux
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.