From patchwork Mon Dec 10 08:55:52 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 1856071 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 72E1EDFB79 for ; Mon, 10 Dec 2012 09:00:21 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1ThzAd-0008G8-5Z; Mon, 10 Dec 2012 08:57:03 +0000 Received: from mail-we0-f177.google.com ([74.125.82.177]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1Thz9z-00088h-Fn for linux-arm-kernel@lists.infradead.org; Mon, 10 Dec 2012 08:56:24 +0000 Received: by mail-we0-f177.google.com with SMTP id x48so1045711wey.36 for ; Mon, 10 Dec 2012 00:56:23 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=Zbjf/6htPlXQ/slLN8Sfia51iQOqdJqJEXPPmcYtt+s=; b=j4pWteLlAvXaXh/TssUAu/e9ObqX2Ca+gu+JsqnCYOnsyQPQw+07fvu0UkiPC+nRUQ JCan9D89uUe/5vn+6evglVklK2cMfe4tFlw566JOcYaOdVKwNUQHRPeWxAuWAL6vQ7wt G4nbmGqJM6NkuKpP9k4aFOHJowLgROIgGfB2Mk+QLNVnp+0KbrY4sQc73YAsp6pxYLJl 5otRnoVYvzS+Umre/aYf/bS/7AFHtuIRGmTuaKixIrvgiu8CCECnsRYqaohNQkvuqWgy QMYj0lgBC5L/Vt5sEXc3UmDHAmxb4gbi6Pa0EHh2UGWd/4qEBjfNEcx7Oe0s/EGqvhJS M5aQ== Received: by 10.216.211.84 with SMTP id v62mr4990184weo.158.1355129783109; Mon, 10 Dec 2012 00:56:23 -0800 (PST) Received: from localhost.localdomain (cpc1-aztw13-0-0-cust473.18-1.cable.virginmedia.com. [77.102.241.218]) by mx.google.com with ESMTPS id fv2sm9173114wib.4.2012.12.10.00.56.21 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 10 Dec 2012 00:56:22 -0800 (PST) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 03/12] regulator: gpio-regulator: Fix logical error in for() loop Date: Mon, 10 Dec 2012 08:55:52 +0000 Message-Id: <1355129761-8088-4-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1355129761-8088-1-git-send-email-lee.jones@linaro.org> References: <1355129761-8088-1-git-send-email-lee.jones@linaro.org> X-Gm-Message-State: ALoCoQm1N9239yP3rDp8QA7K2K8Vp4Qj2gIIJWalFSdGEZuQodvPIeN0ON4zgQk+TlF6w932Enl6 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20121210_035623_734232_1F9EAACE X-CRM114-Status: GOOD ( 13.48 ) 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 [74.125.82.177 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: ulf.hansson@linaro.org, Mark Brown , Lee Jones , linus.walleij@stericsson.com, arnd@arndb.de 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 The cond-statement of this particular for() loop will always be true as long as at least one voltage-shifting GPIO is present. If it wasn't for the break below, we'd be stuck in a forever loop. This patch inserts the correct cond-statement into the statement. Cc: Mark Brown Signed-off-by: Lee Jones --- drivers/regulator/gpio-regulator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/regulator/gpio-regulator.c b/drivers/regulator/gpio-regulator.c index 3afa46a..5462c28 100644 --- a/drivers/regulator/gpio-regulator.c +++ b/drivers/regulator/gpio-regulator.c @@ -181,7 +181,7 @@ of_get_gpio_regulator_config(struct device *dev, struct device_node *np) if (!config->gpios) return ERR_PTR(-ENOMEM); - for (i = 0; config->nr_gpios; i++) { + for (i = 0; i < config->nr_gpios; i++) { gpio = of_get_named_gpio(np, "gpios", i); if (gpio < 0) break;