From: Christophe Leroy <christophe.leroy@c-s.fr> To: Mark Brown <broonie@kernel.org> Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-spi@vger.kernel.org, devicetree@vger.kernel.org, kbuild test robot <lkp@intel.com>, Geert Uytterhoeven <geert@linux-m68k.org> Subject: [PATCH v2 2/2] spi: fsl: simplify error path in of_fsl_spi_probe() Date: Tue, 10 Dec 2019 15:17:16 +0000 (UTC) [thread overview] Message-ID: <539a3b82463f64e8055f166c915f0e90f752c7b0.1575990944.git.christophe.leroy@c-s.fr> (raw) In-Reply-To: <1cdd0a26d7e1545f32c8bc4dc7458ebecdd6aaed.1575990944.git.christophe.leroy@c-s.fr> No need to 'goto err;' for just doing a return. return directly from where the error happens. Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr> --- drivers/spi/spi-fsl-spi.c | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/drivers/spi/spi-fsl-spi.c b/drivers/spi/spi-fsl-spi.c index 2d85c81983b1..e991c6ff4e7a 100644 --- a/drivers/spi/spi-fsl-spi.c +++ b/drivers/spi/spi-fsl-spi.c @@ -725,8 +725,8 @@ static int of_fsl_spi_probe(struct platform_device *ofdev) struct device_node *np = ofdev->dev.of_node; struct spi_master *master; struct resource mem; - int irq = 0, type; - int ret = -ENOMEM; + int irq, type; + int ret; ret = of_mpc8xxx_spi_probe(ofdev); if (ret) @@ -741,10 +741,8 @@ static int of_fsl_spi_probe(struct platform_device *ofdev) if (spisel_boot) { pinfo->immr_spi_cs = ioremap(get_immrbase() + IMMR_SPI_CS_OFFSET, 4); - if (!pinfo->immr_spi_cs) { - ret = -ENOMEM; - goto err; - } + if (!pinfo->immr_spi_cs) + return -ENOMEM; } #endif /* @@ -763,24 +761,17 @@ static int of_fsl_spi_probe(struct platform_device *ofdev) ret = of_address_to_resource(np, 0, &mem); if (ret) - goto err; + return ret; irq = of_irq_to_resource(np, 0, NULL); - if (irq <= 0) { - ret = -EINVAL; - goto err; - } + if (irq <= 0) + return -EINVAL; master = fsl_spi_probe(dev, &mem, irq); - if (IS_ERR(master)) { - ret = PTR_ERR(master); - goto err; - } + if (IS_ERR(master)) + return PTR_ERR(master); return 0; - -err: - return ret; } static int of_fsl_spi_remove(struct platform_device *ofdev) -- 2.13.3
WARNING: multiple messages have this Message-ID (diff)
From: Christophe Leroy <christophe.leroy@c-s.fr> To: Mark Brown <broonie@kernel.org> Cc: devicetree@vger.kernel.org, kbuild test robot <lkp@intel.com>, linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org, Geert Uytterhoeven <geert@linux-m68k.org>, linuxppc-dev@lists.ozlabs.org Subject: [PATCH v2 2/2] spi: fsl: simplify error path in of_fsl_spi_probe() Date: Tue, 10 Dec 2019 15:17:16 +0000 (UTC) [thread overview] Message-ID: <539a3b82463f64e8055f166c915f0e90f752c7b0.1575990944.git.christophe.leroy@c-s.fr> (raw) In-Reply-To: <1cdd0a26d7e1545f32c8bc4dc7458ebecdd6aaed.1575990944.git.christophe.leroy@c-s.fr> No need to 'goto err;' for just doing a return. return directly from where the error happens. Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr> --- drivers/spi/spi-fsl-spi.c | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/drivers/spi/spi-fsl-spi.c b/drivers/spi/spi-fsl-spi.c index 2d85c81983b1..e991c6ff4e7a 100644 --- a/drivers/spi/spi-fsl-spi.c +++ b/drivers/spi/spi-fsl-spi.c @@ -725,8 +725,8 @@ static int of_fsl_spi_probe(struct platform_device *ofdev) struct device_node *np = ofdev->dev.of_node; struct spi_master *master; struct resource mem; - int irq = 0, type; - int ret = -ENOMEM; + int irq, type; + int ret; ret = of_mpc8xxx_spi_probe(ofdev); if (ret) @@ -741,10 +741,8 @@ static int of_fsl_spi_probe(struct platform_device *ofdev) if (spisel_boot) { pinfo->immr_spi_cs = ioremap(get_immrbase() + IMMR_SPI_CS_OFFSET, 4); - if (!pinfo->immr_spi_cs) { - ret = -ENOMEM; - goto err; - } + if (!pinfo->immr_spi_cs) + return -ENOMEM; } #endif /* @@ -763,24 +761,17 @@ static int of_fsl_spi_probe(struct platform_device *ofdev) ret = of_address_to_resource(np, 0, &mem); if (ret) - goto err; + return ret; irq = of_irq_to_resource(np, 0, NULL); - if (irq <= 0) { - ret = -EINVAL; - goto err; - } + if (irq <= 0) + return -EINVAL; master = fsl_spi_probe(dev, &mem, irq); - if (IS_ERR(master)) { - ret = PTR_ERR(master); - goto err; - } + if (IS_ERR(master)) + return PTR_ERR(master); return 0; - -err: - return ret; } static int of_fsl_spi_remove(struct platform_device *ofdev) -- 2.13.3
next prev parent reply other threads:[~2019-12-10 15:17 UTC|newest] Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-12-10 15:17 [PATCH v2 1/2] spi: fsl: don't map irq during probe Christophe Leroy 2019-12-10 15:17 ` Christophe Leroy 2019-12-10 15:17 ` Christophe Leroy [this message] 2019-12-10 15:17 ` [PATCH v2 2/2] spi: fsl: simplify error path in of_fsl_spi_probe() Christophe Leroy 2020-01-14 15:35 ` Mark Brown 2020-01-14 15:35 ` Mark Brown 2020-01-14 15:35 ` Mark Brown 2019-12-10 19:20 ` [PATCH v2 1/2] spi: fsl: don't map irq during probe Mark Brown 2019-12-10 19:20 ` Mark Brown
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=539a3b82463f64e8055f166c915f0e90f752c7b0.1575990944.git.christophe.leroy@c-s.fr \ --to=christophe.leroy@c-s.fr \ --cc=broonie@kernel.org \ --cc=devicetree@vger.kernel.org \ --cc=geert@linux-m68k.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-spi@vger.kernel.org \ --cc=linuxppc-dev@lists.ozlabs.org \ --cc=lkp@intel.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.