From patchwork Tue Mar 1 09:36:23 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrzej Hajda X-Patchwork-Id: 8463431 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 4A4BBC0553 for ; Tue, 1 Mar 2016 09:38:45 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7E669202EC for ; Tue, 1 Mar 2016 09:38:44 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1BAA120304 for ; Tue, 1 Mar 2016 09:38:43 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1aagjn-0004G6-J7; Tue, 01 Mar 2016 09:37:03 +0000 Received: from mailout3.w1.samsung.com ([210.118.77.13]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aagjk-0004Co-3W; Tue, 01 Mar 2016 09:37:01 +0000 Received: from eucpsbgm1.samsung.com (unknown [203.254.199.244]) by mailout3.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0O3C004X1TCYHD50@mailout3.w1.samsung.com>; Tue, 01 Mar 2016 09:36:34 +0000 (GMT) X-AuditID: cbfec7f4-f79026d00000418a-41-56d562a234e8 Received: from eusync2.samsung.com ( [203.254.199.212]) by eucpsbgm1.samsung.com (EUCPMTA) with SMTP id FC.A3.16778.2A265D65; Tue, 1 Mar 2016 09:36:34 +0000 (GMT) Received: from AMDC1061.digital.local ([106.116.147.88]) by eusync2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0O3C00GN0TCYXQ00@eusync2.samsung.com>; Tue, 01 Mar 2016 09:36:34 +0000 (GMT) From: Andrzej Hajda To: Joerg Roedel , Matthias Brugger Subject: [PATCH] iommu/mtk: fix handling of of_count_phandle_with_args result Date: Tue, 01 Mar 2016 10:36:23 +0100 Message-id: <1456824983-13550-1-git-send-email-a.hajda@samsung.com> X-Mailer: git-send-email 1.9.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrPJMWRmVeSWpSXmKPExsVy+t/xK7qLkq6GGbzerWpxa905VouNM9az WizYb23ROXsDu8Wmx9dYLS43X2S0WHvkLrtFU4uxA4fHk4PzmDx2zrrL7rF5Sb3H5BvLGT36 tqxiDGCN4rJJSc3JLEst0rdL4MqYsGo/S8EN9oqXWwsbGN+zdjFyckgImEi82/yEDcIWk7hw bz2QzcUhJLCUUaL//RcmCKeJSaJzQSs7SBWbgKbE3803wTpEBHwlLi98xwpSxCzwh1HiQdtN sLHCQInm+QeYQGwWAVWJ73c+M4LYvALOEh8vL2GHWCcncfLYZNYJjNwLGBlWMYqmliYXFCel 5xrqFSfmFpfmpesl5+duYoQEy5cdjIuPWR1iFOBgVOLh/bD8SpgQa2JZcWXuIUYJDmYlEd5D iVfDhHhTEiurUovy44tKc1KLDzFKc7AoifPO3fU+REggPbEkNTs1tSC1CCbLxMEp1cCoEqMX cuStRJJdr6zquq69UaWJv82a7vZ2LVr0+nbVLXk7aZvO2JXTVlmpfPnMPnmWmOTceRfbDaoz V293XsUdscmhJ2gOZ/zj0y6zn3zs9v9SlTYptM1vQ9XP/fo84o5Kr74aSIYyiMg8m7u28rVp cMXOvHOiMm6z1Y5tMes4uOjD89At1jZKLMUZiYZazEXFiQBaBJWgEgIAAA== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160301_013700_321645_5D9F811A X-CRM114-Status: GOOD ( 12.10 ) X-Spam-Score: -6.9 (------) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bartlomiej Zolnierkiewicz , Andrzej Hajda , iommu@lists.linux-foundation.org, linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Marek Szyprowski MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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 721ffdb..de9241b 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)