From patchwork Mon Dec 14 10:06:00 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrzej Hajda X-Patchwork-Id: 7843021 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 0D32ABEEE1 for ; Mon, 14 Dec 2015 10:10:09 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4AB5220375 for ; Mon, 14 Dec 2015 10:10:08 +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 6090920320 for ; Mon, 14 Dec 2015 10:10:07 +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 1a8Q3f-00063g-42; Mon, 14 Dec 2015 10:08:43 +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 1a8Q39-0005TB-OL for linux-arm-kernel@lists.infradead.org; Mon, 14 Dec 2015 10:08:17 +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 <0NZC002S6ESYN770@mailout3.w1.samsung.com> for linux-arm-kernel@lists.infradead.org; Mon, 14 Dec 2015 10:07:46 +0000 (GMT) X-AuditID: cbfec7f4-f79026d00000418a-74-566e94f1b323 Received: from eusync1.samsung.com ( [203.254.199.211]) by eucpsbgm1.samsung.com (EUCPMTA) with SMTP id 28.9A.16778.1F49E665; Mon, 14 Dec 2015 10:07:45 +0000 (GMT) Received: from AMDC1061.digital.local ([106.116.147.88]) by eusync1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0NZC00KMTES6MI40@eusync1.samsung.com>; Mon, 14 Dec 2015 10:07:45 +0000 (GMT) From: Andrzej Hajda To: =?UTF-8?q?Emilio=20L=C3=B3pez?= Subject: [PATCH] clk: sunxi: fix handling return value of of_property_match_string Date: Mon, 14 Dec 2015 11:06:00 +0100 Message-id: <1450087564-28441-3-git-send-email-a.hajda@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1450087564-28441-1-git-send-email-a.hajda@samsung.com> References: <1450087564-28441-1-git-send-email-a.hajda@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrPLMWRmVeSWpSXmKPExsVy+t/xy7ofp+SFGXx/YGRxa905VouNM9az Wjzb8IXFYtPja6wWH3vusVpc3jWHzWLtkbvsFls37WW2uHjK1eLHmW4Wi5+HzjM5cHu8v9HK 7nG5r5fJY8Oj1awef965ezzZdJHRY/OSeo++LasYPT5vkgvgiOKySUnNySxLLdK3S+DKmLSi qOAsZ8XPJftZGxibOLoYOTkkBEwktvTeZoSwxSQu3FvPBmILCSxllHjSa9LFyAVkNzFJXJu6 DizBJqAp8XfzTTBbRMBK4tziNcwgNrPATGaJFy3qILawQIjE9QPH2UFsFgFVie0Lj7F2MXJw 8Ao4S1w/qgKxS07i5LHJYGFOAReJmRuLQUwhoIpbf6MmMPIuYGRYxSiaWppcUJyUnmuoV5yY W1yal66XnJ+7iRESjF92MC4+ZnWIUYCDUYmHN2NZbpgQa2JZcWXuIUYJDmYlEd4Eq7wwId6U xMqq1KL8+KLSnNTiQ4zSHCxK4rxzd70PERJITyxJzU5NLUgtgskycXBKNTCWf8zklnxXum3u mq/n70VdEC48ybTun2aFG6snn9bjkgeHxefuXc5xpPi2c/ffizpefixGAoecfU6ssTTxUo20 nRDxLeGKvO9lPe8ahiVvvoUveTY/PdX/Zpr8pRNnUy+K+01xe3zZOXDl5oqLb/l5luc1TRYI nMojfmFjZHk752umPaGafVeUWIozEg21mIuKEwEZ+CAIQgIAAA== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151214_020812_607881_E2B28200 X-CRM114-Status: GOOD ( 13.96 ) 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 , Michael Turquette , Stephen Boyd , linux-kernel@vger.kernel.org, Andrzej Hajda , Chen-Yu Tsai , Maxime Ripard , linux-clk@vger.kernel.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, T_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 values, so its result should be assigned to signed variable. The problem has been detected using proposed semantic patch scripts/coccinelle/tests/assign_signed_to_unsigned.cocci [1]. [1]: http://permalink.gmane.org/gmane.linux.kernel/2046107 Signed-off-by: Andrzej Hajda --- drivers/clk/sunxi/clk-sun8i-bus-gates.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/clk/sunxi/clk-sun8i-bus-gates.c b/drivers/clk/sunxi/clk-sun8i-bus-gates.c index 7ab60c5..ecadd97 100644 --- a/drivers/clk/sunxi/clk-sun8i-bus-gates.c +++ b/drivers/clk/sunxi/clk-sun8i-bus-gates.c @@ -47,12 +47,12 @@ static void __init sun8i_h3_bus_gates_init(struct device_node *node) return; for (i = 0; i < ARRAY_SIZE(names); i++) { - index = of_property_match_string(node, "clock-names", - names[i]); - if (index < 0) + int idx = of_property_match_string(node, "clock-names", + names[i]); + if (idx < 0) return; - parents[i] = of_clk_get_parent_name(node, index); + parents[i] = of_clk_get_parent_name(node, idx); } clk_data = kmalloc(sizeof(struct clk_onecell_data), GFP_KERNEL);