From patchwork Fri Jan 18 07:31:09 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Haojian Zhuang X-Patchwork-Id: 1999711 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id A3424DF280 for ; Fri, 18 Jan 2013 07:35:37 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1Tw6Rk-00063L-Rw; Fri, 18 Jan 2013 07:33:05 +0000 Received: from mail-pb0-f46.google.com ([209.85.160.46]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1Tw6QW-0005bq-4W for linux-arm-kernel@lists.infradead.org; Fri, 18 Jan 2013 07:31:49 +0000 Received: by mail-pb0-f46.google.com with SMTP id wy7so1890152pbc.33 for ; Thu, 17 Jan 2013 23:31:46 -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=h5OfM/8t5RdSdlBN9PLLvxP7l3qIXg/biikxdxdjgqY=; b=ZTqsCNCe+fSok2AmO3viLEGYbAjPKF2sF3AmX2YnoV/n29DQilQai1pnUc6BZtT5gf gN1BjWWU0MrzmaowwSECykSS7JifyYQbi2FsPfSsLzvTGIZLdMzP3X4Vy/mZepHaKOb+ 82niBNIMBXrMz/Jn3bCoXy9GkVsiBTFnf2fRNNa0H7468fXLzVZhmGJaw8WWHqU1kL80 XMBo3KYpG5/Kd03o+qdIIEEyG07GbjzngvoolCxaxLo27wGu7J9TvVWwJeuOxaS9BT+E 3uruhwY5Oyc+kRcYXxHWV1w19bUnOzbDqPyZQKP0QmabNPUB/pxmolhYRFFE1hOzXkzC qM+g== X-Received: by 10.68.241.136 with SMTP id wi8mr21568520pbc.95.1358494306442; Thu, 17 Jan 2013 23:31:46 -0800 (PST) Received: from localhost.localdomain ([98.126.173.75]) by mx.google.com with ESMTPS id i6sm2922899paw.19.2013.01.17.23.31.43 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 17 Jan 2013 23:31:45 -0800 (PST) From: Haojian Zhuang To: linus.walleij@linaro.org, linux@arm.linux.org.uk, tony@atomide.com, linux-arm-kernel@lists.infradead.org, swarren@nvidia.com Subject: [PATCH v7 05/15] gpio: fix wrong checking condition for gpio range Date: Fri, 18 Jan 2013 15:31:09 +0800 Message-Id: <1358494279-16503-6-git-send-email-haojian.zhuang@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1358494279-16503-1-git-send-email-haojian.zhuang@linaro.org> References: <1358494279-16503-1-git-send-email-haojian.zhuang@linaro.org> X-Gm-Message-State: ALoCoQk8nmeMRgUdebbHxd75yFIYA8zMOwzL15ZGpBHF2eZutHT5qq/gSd17vNRdrZXdqM4RAFUf X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130118_023148_304248_B6F07110 X-CRM114-Status: GOOD ( 10.31 ) 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.160.46 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Haojian Zhuang 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 Since index++ calculates from 0, the checking condition of "while (index++)" is always fake. So replace it by unconditional loop. Signed-off-by: Haojian Zhuang --- drivers/gpio/gpiolib-of.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c index b1f0682..011e1e98 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 (;;) { ret = of_parse_phandle_with_args(np, "gpio-ranges", "#gpio-range-cells", index, &pinspec); if (ret) @@ -254,8 +254,8 @@ static void of_gpiochip_add_pin_range(struct gpio_chip *chip) if (ret) break; - - } while (index++); + index++; + } } #else