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: 14421 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id AFC5123F96 for ; Sat, 2 Feb 2013 17:26:21 +0000 (UTC) Received: from mail-vb0-f54.google.com (mail-vb0-f54.google.com [209.85.212.54]) by fiordland.canonical.com (Postfix) with ESMTP id 68DC0A18D77 for ; Sat, 2 Feb 2013 17:26:21 +0000 (UTC) Received: by mail-vb0-f54.google.com with SMTP id l1so3072381vba.13 for ; Sat, 02 Feb 2013 09:26:21 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:x-received:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state; bh=YCr8KQ0WVfKcfyAfqJARo+/cstLqIZJGNij94ZbmBQY=; b=VUQd0gwtwr9XMNoKpfDjNMURxmalwxnoCY0UKa62jUHJyP/KHPQCG4xMmz3GuGTDo2 t/Jnw+siodR32wr1mBXMJlCLS9DLo/rGi1IZLlRT1S6TCZ4fW6vGkQGdWLzryaLU94oy OB+mRJxf8TiCHNdVjPkwf8QA/YEV8dDNxIV1eVFx3v2yuZY4lT76iav29NDXGqvR6sK+ LdkOzfA/VXyVLwc4TBUoYaylZlDMH/YclcVFFCUM7mUn+EyqE4rXaKd4j9U577iOLmCI bw6kCEPh0XXWRlrmkTLGdbFBc0GyEWSq36c5T1+6lZq/eUfJ4VYKYf1VYkm4/IceZGKw FHRg== X-Received: by 10.52.21.146 with SMTP id v18mr13066921vde.79.1359825980838; Sat, 02 Feb 2013 09:26:20 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.58.252.8 with SMTP id zo8csp16813vec; Sat, 2 Feb 2013 09:26:20 -0800 (PST) X-Received: by 10.69.16.100 with SMTP id fv4mr41974761pbd.135.1359825980158; Sat, 02 Feb 2013 09:26:20 -0800 (PST) Received: from mail-pa0-f43.google.com (mail-pa0-f43.google.com [209.85.220.43]) by mx.google.com with ESMTPS id e5si11571096pax.319.2013.02.02.09.26.19 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 02 Feb 2013 09:26:20 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.43 is neither permitted nor denied by best guess record for domain of haojian.zhuang@linaro.org) client-ip=209.85.220.43; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.43 is neither permitted nor denied by best guess record for domain of haojian.zhuang@linaro.org) smtp.mail=haojian.zhuang@linaro.org Received: by mail-pa0-f43.google.com with SMTP id bh2so454032pad.2 for ; Sat, 02 Feb 2013 09:26:19 -0800 (PST) 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 Cc: patches@linaro.org, Haojian Zhuang 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: ALoCoQkFYmQL//ECrjoe2hqdcAYjrn7PrHGPC/qzbCRQuEoIRLukVhsI9lPA2fkmK1l2meYqQ3+P 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