diff mbox

[1/3] mmc: mxs-mmc: No need to do NULL check on 'iores'

Message ID 1416403019-6353-1-git-send-email-fabio.estevam@freescale.com (mailing list archive)
State New, archived
Headers show

Commit Message

Fabio Estevam Nov. 19, 2014, 1:16 p.m. UTC
devm_ioremap_resource() already checks if 'iores' is NULL or not, so we can
skip this manual check.

While at it, move platform_get_resource() closer to devm_ioremap_resource() for
better readability.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
 drivers/mmc/host/mxs-mmc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Ulf Hansson Nov. 24, 2014, 8:36 a.m. UTC | #1
On 19 November 2014 at 14:16, Fabio Estevam <fabio.estevam@freescale.com> wrote:
> devm_ioremap_resource() already checks if 'iores' is NULL or not, so we can
> skip this manual check.
>
> While at it, move platform_get_resource() closer to devm_ioremap_resource() for
> better readability.
>
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>

Thanks! Applied for next.

Kind regards
Uffe

> ---
>  drivers/mmc/host/mxs-mmc.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mmc/host/mxs-mmc.c b/drivers/mmc/host/mxs-mmc.c
> index c049ac7..0d30730 100644
> --- a/drivers/mmc/host/mxs-mmc.c
> +++ b/drivers/mmc/host/mxs-mmc.c
> @@ -581,9 +581,8 @@ static int mxs_mmc_probe(struct platform_device *pdev)
>         struct regulator *reg_vmmc;
>         struct mxs_ssp *ssp;
>
> -       iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>         irq_err = platform_get_irq(pdev, 0);
> -       if (!iores || irq_err < 0)
> +       if (irq_err < 0)
>                 return -EINVAL;
>
>         mmc = mmc_alloc_host(sizeof(struct mxs_mmc_host), &pdev->dev);
> @@ -593,6 +592,7 @@ static int mxs_mmc_probe(struct platform_device *pdev)
>         host = mmc_priv(mmc);
>         ssp = &host->ssp;
>         ssp->dev = &pdev->dev;
> +       iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>         ssp->base = devm_ioremap_resource(&pdev->dev, iores);
>         if (IS_ERR(ssp->base)) {
>                 ret = PTR_ERR(ssp->base);
> --
> 1.9.1
>
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/mmc/host/mxs-mmc.c b/drivers/mmc/host/mxs-mmc.c
index c049ac7..0d30730 100644
--- a/drivers/mmc/host/mxs-mmc.c
+++ b/drivers/mmc/host/mxs-mmc.c
@@ -581,9 +581,8 @@  static int mxs_mmc_probe(struct platform_device *pdev)
 	struct regulator *reg_vmmc;
 	struct mxs_ssp *ssp;
 
-	iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	irq_err = platform_get_irq(pdev, 0);
-	if (!iores || irq_err < 0)
+	if (irq_err < 0)
 		return -EINVAL;
 
 	mmc = mmc_alloc_host(sizeof(struct mxs_mmc_host), &pdev->dev);
@@ -593,6 +592,7 @@  static int mxs_mmc_probe(struct platform_device *pdev)
 	host = mmc_priv(mmc);
 	ssp = &host->ssp;
 	ssp->dev = &pdev->dev;
+	iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	ssp->base = devm_ioremap_resource(&pdev->dev, iores);
 	if (IS_ERR(ssp->base)) {
 		ret = PTR_ERR(ssp->base);