From patchwork Mon Feb 11 17:10:49 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Haojian Zhuang X-Patchwork-Id: 14743 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 7346323DEA for ; Mon, 11 Feb 2013 17:11:27 +0000 (UTC) Received: from mail-ve0-f178.google.com (mail-ve0-f178.google.com [209.85.128.178]) by fiordland.canonical.com (Postfix) with ESMTP id 30E8BA19314 for ; Mon, 11 Feb 2013 17:11:27 +0000 (UTC) Received: by mail-ve0-f178.google.com with SMTP id db10so5311099veb.9 for ; Mon, 11 Feb 2013 09:11:26 -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=B+bjkjHt+1TMkuDdD1fmasUZvkLN9JXDHWJnX0IQH8k=; b=AdsGqNNgk0Xth1zUzrJXpTFltlxWP4umGJlgK9wW1GpEoA0gczHF4guCrg03xGi1G7 yw0TrzyOZVak/rxq7iO3H7pRAd5H36xxu/nB7poukXJyV7FUv5CbUfjcdW1eEg3KuDUf Pi8RxueizWZEUErJ90hW48gPT7TIRCVuDTq4lnRVx9bVhWGWLGpGj17X087C0JCZLRmQ TWG4CuCBI/nT7H+V7ahvaxLCTY06M8h9nHymEAzVXs5hgM6duTJjMcR2rnZdfY5aCNAg p1bS1CAp4+S20fOAYIJIHpxW8EToWNo1rKhCgHaaaVhUNoyMA33vXSkfUkwaSN+GE70x KmYg== X-Received: by 10.220.149.200 with SMTP id u8mr19877728vcv.7.1360602685241; Mon, 11 Feb 2013 09:11:25 -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 zo8csp107984vec; Mon, 11 Feb 2013 09:11:24 -0800 (PST) X-Received: by 10.66.75.66 with SMTP id a2mr42610781paw.65.1360602684317; Mon, 11 Feb 2013 09:11:24 -0800 (PST) Received: from mail-da0-f47.google.com (mail-da0-f47.google.com [209.85.210.47]) by mx.google.com with ESMTPS id p10si48540098pay.119.2013.02.11.09.11.23 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 11 Feb 2013 09:11:24 -0800 (PST) Received-SPF: neutral (google.com: 209.85.210.47 is neither permitted nor denied by best guess record for domain of haojian.zhuang@linaro.org) client-ip=209.85.210.47; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.210.47 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-da0-f47.google.com with SMTP id s35so2749019dak.20 for ; Mon, 11 Feb 2013 09:11:23 -0800 (PST) X-Received: by 10.66.84.232 with SMTP id c8mr42933012paz.8.1360602683396; Mon, 11 Feb 2013 09:11:23 -0800 (PST) Received: from localhost.localdomain ([27.115.121.35]) by mx.google.com with ESMTPS id m3sm67935973pav.4.2013.02.11.09.11.18 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 11 Feb 2013 09:11:22 -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, grant.likely@secretlab.ca, linus.walleij@linaro.org Cc: patches@linaro.org, Haojian Zhuang Subject: [PATCH v8 02/12] gpio: fix wrong checking condition for gpio range Date: Tue, 12 Feb 2013 01:10:49 +0800 Message-Id: <1360602659-4774-3-git-send-email-haojian.zhuang@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1360602659-4774-1-git-send-email-haojian.zhuang@linaro.org> References: <1360602659-4774-1-git-send-email-haojian.zhuang@linaro.org> X-Gm-Message-State: ALoCoQkjGFEteujtGYGV3MIvy6JtMuGRtW+g5SgLksqx/7yaL6QOlQiW6O1onOaB/xpI248Z3Gpb 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