From patchwork Sun Feb 17 11:42:48 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Haojian Zhuang X-Patchwork-Id: 14931 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 AE9F623E1A for ; Sun, 17 Feb 2013 11:44:21 +0000 (UTC) Received: from mail-ve0-f174.google.com (mail-ve0-f174.google.com [209.85.128.174]) by fiordland.canonical.com (Postfix) with ESMTP id 67262A18521 for ; Sun, 17 Feb 2013 11:44:21 +0000 (UTC) Received: by mail-ve0-f174.google.com with SMTP id pb11so4206618veb.33 for ; Sun, 17 Feb 2013 03:44:20 -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=M/YRmKfj+95PVxoEouvjo7i6ZaiYJDqqRF0pp3VFoW0=; b=BJ7FnCKif2dDGuW2Ui74LEBuzrJSZ5Ie3w5u4q3X34oG0iq14zkYuWk5RWKkwReI1o kX1vt3D/Rz+siEAOV60+i6+AkfyDZueGqQghSS30i+S6bx8kfEi2ETZXtqhppcV9nk/O Nn3+eRAhIss2JVuqOUxx40KcHLpc5b259n8iStq4fqGlzvBNMl1RfyIjbSNPjy32NPT+ tHq9ZVyPN/JDHW4aKHzh613Gro4tv5wvN9DmWt4R5AKXpYIn5P7SKQNCQPUQw26NedFa vGe9V+sWI4GDsnz8qcP4nPG4H4N4zRTwIp3wIzIpCYZ9LzYd0F2xNOefPJqReVm9xhPV 18Hg== X-Received: by 10.52.18.148 with SMTP id w20mr9647065vdd.8.1361101460879; Sun, 17 Feb 2013 03:44: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.145.101 with SMTP id st5csp43081veb; Sun, 17 Feb 2013 03:44:20 -0800 (PST) X-Received: by 10.68.17.104 with SMTP id n8mr4770090pbd.18.1361101459951; Sun, 17 Feb 2013 03:44:19 -0800 (PST) Received: from mail-pa0-f42.google.com (mail-pa0-f42.google.com [209.85.220.42]) by mx.google.com with ESMTPS id o9si17366968paw.224.2013.02.17.03.44.19 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 17 Feb 2013 03:44:19 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.42 is neither permitted nor denied by best guess record for domain of haojian.zhuang@linaro.org) client-ip=209.85.220.42; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.42 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-f42.google.com with SMTP id kq12so2411162pab.15 for ; Sun, 17 Feb 2013 03:44:19 -0800 (PST) X-Received: by 10.68.35.6 with SMTP id d6mr7804742pbj.167.1361101459521; Sun, 17 Feb 2013 03:44:19 -0800 (PST) Received: from localhost.localdomain ([67.198.145.34]) by mx.google.com with ESMTPS id hp7sm10927800pbc.8.2013.02.17.03.44.15 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 17 Feb 2013 03:44:18 -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 v9 02/10] gpio: fix wrong checking condition for gpio range Date: Sun, 17 Feb 2013 19:42:48 +0800 Message-Id: <1361101376-3783-3-git-send-email-haojian.zhuang@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1361101376-3783-1-git-send-email-haojian.zhuang@linaro.org> References: <1361101376-3783-1-git-send-email-haojian.zhuang@linaro.org> X-Gm-Message-State: ALoCoQlbu9vLozYatXaQa/6Cd4r0AxG4Yt/+Wl6TzV/QH8qCSfZJ0dO6Vx3FiDOSjg+Bmybtc3th 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 892040a..465f4ca 100644 --- a/drivers/gpio/gpiolib-of.c +++ b/drivers/gpio/gpiolib-of.c @@ -193,7 +193,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) @@ -211,8 +211,7 @@ static void of_gpiochip_add_pin_range(struct gpio_chip *chip) if (ret) break; - - } while (index++); + } } #else