Skip to contentSkip to conversation

iommu/mtk: fix handling of of_count_phandle_with_args result

PATCH New Andrzej Hajda 3 participants 3 messages Mar 1, 2016

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iommu/mtk: fix handling of of_count_phandle_with_args result

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.

---
 drivers/iommu/mtk_iommu.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/iommu/mtk_iommu.c +1 -2
index 721ffdb..de9241b 100644
@@ -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)
Signature · 1 line
1.9.1
maintainer Applied
#1 lore raw

PATCH 1/1 iommu/mtk: fix handling of of_count_phandle_with_args result

Quoted 11 lines · Andrzej Hajda

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.

---
 drivers/iommu/mtk_iommu.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Applied, thanks.

maintainer
#2 lore raw

PATCH 1/1 iommu/mtk: fix handling of of_count_phandle_with_args result

Quoted 8 lines · Joerg Roedel
Quoted 7 lines · Andrzej Hajda

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.

Quoted 6 lines
Quoted 4 lines
---
 drivers/iommu/mtk_iommu.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Applied, thanks.

Thanks.

nit: It would be better to use iommu/mediatek.

Quoted 5 lines

_______________________________________________
iommu mailing list
iommu at lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu