From patchwork Sun May 24 02:13:45 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Welling X-Patchwork-Id: 6470891 Return-Path: X-Original-To: patchwork-linux-spi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 05B309F399 for ; Sun, 24 May 2015 02:15:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 14840205B9 for ; Sun, 24 May 2015 02:15:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 555C7205B8 for ; Sun, 24 May 2015 02:15:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932145AbbEXCOV (ORCPT ); Sat, 23 May 2015 22:14:21 -0400 Received: from mail-ig0-f181.google.com ([209.85.213.181]:35769 "EHLO mail-ig0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752813AbbEXCOL (ORCPT ); Sat, 23 May 2015 22:14:11 -0400 Received: by igbyr2 with SMTP id yr2so15904472igb.0; Sat, 23 May 2015 19:14:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=cKm/xcs2rTSJSGgX3zeFR9NOALs+nKAO5jaBteS9uCc=; b=nDY2Y6Am/z3EP9ygSKMfD4Uj3l+InDGr6k5gj6jpRl1KN+0QNQb0fMvPu7zAI5cRwX M4S5uCpAobXMz0Y1a32tOaiRDUs0a4C/3WK7/YCW1hfHnFOhd9M0eLFS5GbaR6/Cp+v/ FU2V7mBlZm5IZgy7pQZD0VbcpMkJ2uOykl/W4PTFnloVlNz4iQqqNK8Y9b5tAcBCJh0n 9wuSZvBPMqqBM8SRFi3iuOAWipYoOr5UBNVsBp9E1c3lMLfgqIMmaMSGNCMSowCRMHQW xq/5sicyC1u31515SC9EEXxtmVKTAvN7+zBrkBjdnukq3hUEl6IExJxASI8zbQrFqixE LpQw== X-Received: by 10.50.30.69 with SMTP id q5mr15082552igh.11.1432433651080; Sat, 23 May 2015 19:14:11 -0700 (PDT) Received: from localhost.localdomain (74-84-113-14.client.mchsi.com. [74.84.113.14]) by mx.google.com with ESMTPSA id d15sm2847465igo.8.2015.05.23.19.14.09 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 23 May 2015 19:14:10 -0700 (PDT) From: Michael Welling To: broonie@kernel.org, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-next@vger.kernel.org, linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Michael Welling Subject: [PATCH 4/4] spi: omap2-mcspi: Handle error on gpio_request Date: Sat, 23 May 2015 21:13:45 -0500 Message-Id: <1432433625-23407-5-git-send-email-mwelling@ieee.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1432433625-23407-1-git-send-email-mwelling@ieee.org> References: <20150522122544.GL21391@sirena.org.uk> <1432433625-23407-1-git-send-email-mwelling@ieee.org> Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP If a valid GPIO is specified but cannot be requested by the driver, print a message and error out of omap2_mcspi_setup. Signed-off-by: Michael Welling --- drivers/spi/spi-omap2-mcspi.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c index c4e21ad..5867384 100644 --- a/drivers/spi/spi-omap2-mcspi.c +++ b/drivers/spi/spi-omap2-mcspi.c @@ -1023,9 +1023,12 @@ static int omap2_mcspi_setup(struct spi_device *spi) } if (gpio_is_valid(spi->cs_gpio)) { - if (gpio_request(spi->cs_gpio, dev_name(&spi->dev)) == 0) - gpio_direction_output(spi->cs_gpio, - !(spi->mode & SPI_CS_HIGH)); + ret = gpio_request(spi->cs_gpio, dev_name(&spi->dev)); + if (ret) { + dev_err(&spi->dev, "failed to request gpio\n"); + return ret; + } + gpio_direction_output(spi->cs_gpio, !(spi->mode & SPI_CS_HIGH)); } ret = pm_runtime_get_sync(mcspi->dev);