Skip to content

Commit

Permalink
iommu/mediatek: Fix handling of of_count_phandle_with_args result
Browse files Browse the repository at this point in the history
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 <a.hajda@samsung.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
  • Loading branch information
Andrzej Hajda authored and Joerg Roedel committed Mar 1, 2016
1 parent fd99f79 commit 0b6c0ad
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions drivers/iommu/mtk_iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 0b6c0ad

Please sign in to comment.