From patchwork Tue Nov 24 16:53:07 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Ogness X-Patchwork-Id: 62532 Received: from lists.sourceforge.net (lists.sourceforge.net [216.34.181.88]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id nAOHeLt0009482 for ; Tue, 24 Nov 2009 17:40:21 GMT Received: from localhost ([127.0.0.1] helo=sfs-ml-4.v29.ch3.sourceforge.com) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.69) (envelope-from ) id 1NCzMV-0001ho-C4; Tue, 24 Nov 2009 17:39:35 +0000 Received: from sfi-mx-4.v28.ch3.sourceforge.com ([172.29.28.124] helo=mx.sourceforge.net) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.69) (envelope-from ) id 1NCzMT-0001hg-Pp for spi-devel-general@lists.sourceforge.net; Tue, 24 Nov 2009 17:39:33 +0000 X-ACL-Warn: Received: from www.tglx.de ([62.245.132.106]) by sfi-mx-4.v28.ch3.sourceforge.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.69) id 1NCzMN-0007pp-Un for spi-devel-general@lists.sourceforge.net; Tue, 24 Nov 2009 17:39:33 +0000 Received: from merkur.tec.linutronix.de (www.tglx.de [127.0.0.1]) by www.tglx.de (8.13.8/8.13.8/TGLX-2007100201) with ESMTP id nAOGr7Ac012102; Tue, 24 Nov 2009 17:53:07 +0100 To: s.hauer@pengutronix.de From: John Ogness Date: Tue, 24 Nov 2009 17:53:07 +0100 Message-ID: <807htfsw3w.fsf@merkur.tec.linutronix.de> User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.3 (gnu/linux) MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.95.1 at www.tglx.de X-Virus-Status: Clean X-Spam-Status: No, score=-2.5 required=5.0 tests=ALL_TRUSTED,AWL autolearn=failed version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on www.tglx.de X-Spam-Score: -2.0 (--) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -2.0 AWL AWL: From: address is in the auto white-list X-Headers-End: 1NCzMN-0007pp-Un Cc: spi-devel-general@lists.sourceforge.net, linux-kernel@vger.kernel.org Subject: [spi-devel-general] [PATCH] SPI/i.MX: fix broken error handling for gpio_request X-BeenThere: spi-devel-general@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list List-Id: Linux SPI core/device drivers discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: spi-devel-general-bounces@lists.sourceforge.net --- a/drivers/spi/spi_imx.c +++ b/drivers/spi/spi_imx.c @@ -513,11 +513,12 @@ static int __init spi_imx_probe(struct p continue; ret = gpio_request(spi_imx->chipselect[i], DRIVER_NAME); if (ret) { - i--; - while (i > 0) + while (i > 0) { + i--; if (spi_imx->chipselect[i] >= 0) - gpio_free(spi_imx->chipselect[i--]); - dev_err(&pdev->dev, "can't get cs gpios"); + gpio_free(spi_imx->chipselect[i]); + } + dev_err(&pdev->dev, "can't get cs gpios\n"); goto out_master_put; } }