From patchwork Sun Sep 25 05:59:23 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 9349477 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 288E3601C2 for ; Sun, 25 Sep 2016 05:59:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 179EB2843E for ; Sun, 25 Sep 2016 05:59:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0BF8828555; Sun, 25 Sep 2016 05:59:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EBAD628E29 for ; Sun, 25 Sep 2016 05:59:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S938785AbcIYF7m (ORCPT ); Sun, 25 Sep 2016 01:59:42 -0400 Received: from mezzanine.sirena.org.uk ([106.187.55.193]:39998 "EHLO mezzanine.sirena.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S938680AbcIYF7g (ORCPT ); Sun, 25 Sep 2016 01:59:36 -0400 Received: from [67.238.99.186] (helo=finisterre) by mezzanine.sirena.org.uk with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bo2TK-0007s7-DK; Sun, 25 Sep 2016 05:59:32 +0000 Received: from broonie by finisterre with local (Exim 4.87) (envelope-from ) id 1bo2TD-0003GD-3j; Sat, 24 Sep 2016 22:59:23 -0700 From: Mark Brown To: Heiner Kallweit Cc: Heiner Kallweit , Mark Brown , Mark Brown , "linux-spi@vger.kernel.org" , linux-spi@vger.kernel.org In-Reply-To: Message-Id: Date: Sat, 24 Sep 2016 22:59:23 -0700 X-SA-Exim-Connect-IP: 67.238.99.186 X-SA-Exim-Mail-From: broonie@sirena.org.uk Subject: Applied "spi: fsl-espi: improve return value handling in fsl_espi_probe" to the spi tree X-SA-Exim-Version: 4.2.1 (built Mon, 26 Dec 2011 16:24:06 +0000) X-SA-Exim-Scanned: No (on mezzanine.sirena.org.uk); Unknown failure Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The patch spi: fsl-espi: improve return value handling in fsl_espi_probe has been applied to the spi tree at git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark From 604042af7697314fffb16e266fd7d5ad488439cc Mon Sep 17 00:00:00 2001 From: Heiner Kallweit Date: Sat, 17 Sep 2016 15:43:31 +0200 Subject: [PATCH] spi: fsl-espi: improve return value handling in fsl_espi_probe The return value of fsl_espi_probe (currently struct spi_master *) is just used for checking whether an error occurred. Change the return value type to int and simplify the code. Signed-off-by: Heiner Kallweit Signed-off-by: Mark Brown --- drivers/spi/spi-fsl-espi.c | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/drivers/spi/spi-fsl-espi.c b/drivers/spi/spi-fsl-espi.c index dee3f822cea8..7451585a080e 100644 --- a/drivers/spi/spi-fsl-espi.c +++ b/drivers/spi/spi-fsl-espi.c @@ -538,8 +538,8 @@ static size_t fsl_espi_max_message_size(struct spi_device *spi) return SPCOM_TRANLEN_MAX; } -static struct spi_master * fsl_espi_probe(struct device *dev, - struct resource *mem, unsigned int irq) +static int fsl_espi_probe(struct device *dev, struct resource *mem, + unsigned int irq) { struct fsl_spi_platform_data *pdata = dev_get_platdata(dev); struct spi_master *master; @@ -547,13 +547,11 @@ static struct spi_master * fsl_espi_probe(struct device *dev, struct device_node *nc; const __be32 *prop; u32 regval, csmode; - int i, len, ret = 0; + int i, len, ret; master = spi_alloc_master(dev, sizeof(struct mpc8xxx_spi)); - if (!master) { - ret = -ENOMEM; - goto err; - } + if (!master) + return -ENOMEM; dev_set_drvdata(dev, master); @@ -647,7 +645,7 @@ static struct spi_master * fsl_espi_probe(struct device *dev, pm_runtime_mark_last_busy(dev); pm_runtime_put_autosuspend(dev); - return master; + return 0; err_pm: pm_runtime_put_noidle(dev); @@ -655,8 +653,7 @@ err_pm: pm_runtime_set_suspended(dev); err_probe: spi_master_put(master); -err: - return ERR_PTR(ret); + return ret; } static int of_fsl_espi_get_chipselects(struct device *dev) @@ -682,7 +679,6 @@ static int of_fsl_espi_probe(struct platform_device *ofdev) { struct device *dev = &ofdev->dev; struct device_node *np = ofdev->dev.of_node; - struct spi_master *master; struct resource mem; unsigned int irq; int ret; @@ -703,11 +699,7 @@ static int of_fsl_espi_probe(struct platform_device *ofdev) if (!irq) return -EINVAL; - master = fsl_espi_probe(dev, &mem, irq); - if (IS_ERR(master)) - return PTR_ERR(master); - - return 0; + return fsl_espi_probe(dev, &mem, irq); } static int of_fsl_espi_remove(struct platform_device *dev)