From patchwork Sat Feb 2 17:25:43 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Haojian Zhuang X-Patchwork-Id: 2084501 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id 76CDF3FD2B for ; Sat, 2 Feb 2013 17:29:05 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1U1grE-0000zU-NA; Sat, 02 Feb 2013 17:26:28 +0000 Received: from mail-da0-f53.google.com ([209.85.210.53]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1U1gr7-0000xY-N3 for linux-arm-kernel@lists.infradead.org; Sat, 02 Feb 2013 17:26:22 +0000 Received: by mail-da0-f53.google.com with SMTP id x6so2111421dac.40 for ; Sat, 02 Feb 2013 09:26:19 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references:x-gm-message-state; bh=YCr8KQ0WVfKcfyAfqJARo+/cstLqIZJGNij94ZbmBQY=; b=N2J/HX6wFulDtp7t1frFLWDCfFzO5tFKCbf0wrhN/RZGMhTnT8Yrqn/q1PpOIhMDLk MsTmXv5ZKfMVujVfgDIjHdT8BXPxWJkVBD1PjIbtykdIsiRsiCgsQ/AorAgz7uhOkpuk Tb3obLESQvnpssUb9GH+fWl9yoNmzYbNXoNaWxhXH+0dHJrgCb/tT7cvJncgObtCnPc+ iVluliSNv6P7nrv59hdc6IlCBUwBeR+uK6zxQ5yqbAok8+5mk/Pa5+IxTwcvGCf3Nsiy SZwyw+9B1G5QQypTGlXqpbzrHFSd971hldX/4QfAwXqh4kdPQa9XuMFsYtI1STEuXbh5 vWaw== X-Received: by 10.66.9.2 with SMTP id v2mr39196295paa.18.1359825979762; Sat, 02 Feb 2013 09:26:19 -0800 (PST) Received: from localhost.localdomain ([27.115.121.35]) by mx.google.com with ESMTPS id b3sm10434040pax.14.2013.02.02.09.26.13 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 02 Feb 2013 09:26:19 -0800 (PST) From: Haojian Zhuang To: shiraz.hashim@st.com, shiraz.linux.kernel@gmail.com, linux@arm.linux.org.uk, tony@atomide.com, linux-arm-kernel@lists.infradead.org, swarren@nvidia.com Subject: [PATCH v8 02/12] gpio: fix wrong checking condition for gpio range Date: Sun, 3 Feb 2013 01:25:43 +0800 Message-Id: <1359825953-15663-3-git-send-email-haojian.zhuang@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1359825953-15663-1-git-send-email-haojian.zhuang@linaro.org> References: <1359825953-15663-1-git-send-email-haojian.zhuang@linaro.org> X-Gm-Message-State: ALoCoQlW8iKITq/NXI3GuPidWmTUhK7g09Ql/KXhaBNg/zBBdj6E6Ci1CtUsNJLQbMOXXJVRIma9 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130202_122621_872842_38EAFA25 X-CRM114-Status: UNSURE ( 9.13 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.210.53 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Haojian Zhuang , patches@linaro.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org If index++ calculates from 0, the checking condition of "while (index++)" fails & it doesn't check any more. It doesn't follow the loop that used at here. Replace it by endless loop at here. Then it keeps parsing "gpio-ranges" property until it ends. Signed-off-by: Haojian Zhuang Reviewed-by: Linus Walleij --- drivers/gpio/gpiolib-of.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c index 380f84e..dae24c0 100644 --- a/drivers/gpio/gpiolib-of.c +++ b/drivers/gpio/gpiolib-of.c @@ -228,7 +228,7 @@ static void of_gpiochip_add_pin_range(struct gpio_chip *chip) if (!np) return; - do { + for (;; index++) { ret = of_parse_phandle_with_args(np, "gpio-ranges", "#gpio-range-cells", index, &pinspec); if (ret) @@ -246,8 +246,7 @@ static void of_gpiochip_add_pin_range(struct gpio_chip *chip) if (ret) break; - - } while (index++); + } } #else