linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
To: Shubhrajyoti D <shubhrajyoti-l0cyMroinI0@public.gmane.org>
Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, "Hebbar,
	Gururaja" <gururaja.hebbar-l0cyMroinI0@public.gmane.org>
Subject: Re: [PATCH 3/3] OMAP: SPI: Correct the error path
Date: Sat, 29 Oct 2011 14:07:09 +0200	[thread overview]
Message-ID: <20111029120709.GF22592@ponder.secretlab.ca> (raw)
In-Reply-To: <1319802259-16565-4-git-send-email-shubhrajyoti-l0cyMroinI0@public.gmane.org>

On Fri, Oct 28, 2011 at 05:14:19PM +0530, Shubhrajyoti D wrote:
> Currently McSPI driver doesnt follow correct failure fallback steps
> attempting to correct the same.
> Also
> -  label names changed  to give meaningful names.
> - Setting the driver data to NULL in remove
> 
> Signed-off-by: Hebbar, Gururaja <gururaja.hebbar-l0cyMroinI0@public.gmane.org>
> Signed-off-by: Shubhrajyoti D <shubhrajyoti-l0cyMroinI0@public.gmane.org>

Applied for v3.3, thanks.

g.

> ---
>  drivers/spi/spi-omap2-mcspi.c |   32 ++++++++++++++++++++------------
>  1 files changed, 20 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c
> index 6875a0b..abe2fee 100644
> --- a/drivers/spi/spi-omap2-mcspi.c
> +++ b/drivers/spi/spi-omap2-mcspi.c
> @@ -1115,13 +1115,13 @@ static int __init omap2_mcspi_probe(struct platform_device *pdev)
>  	mcspi->wq = alloc_workqueue(wq_name, WQ_MEM_RECLAIM, 1);
>  	if (mcspi->wq == NULL) {
>  		status = -ENOMEM;
> -		goto err1;
> +		goto free_master;
>  	}
>  
>  	r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>  	if (r == NULL) {
>  		status = -ENODEV;
> -		goto err1;
> +		goto free_master;
>  	}
>  	r->start += pdata->regs_offset;
>  	r->end += pdata->regs_offset;
> @@ -1129,14 +1129,14 @@ static int __init omap2_mcspi_probe(struct platform_device *pdev)
>  	if (!request_mem_region(r->start, resource_size(r),
>  				dev_name(&pdev->dev))) {
>  		status = -EBUSY;
> -		goto err1;
> +		goto free_master;
>  	}
>  
>  	mcspi->base = ioremap(r->start, resource_size(r));
>  	if (!mcspi->base) {
>  		dev_dbg(&pdev->dev, "can't ioremap MCSPI\n");
>  		status = -ENOMEM;
> -		goto err2;
> +		goto release_region;
>  	}
>  
>  	mcspi->dev = &pdev->dev;
> @@ -1151,7 +1151,7 @@ static int __init omap2_mcspi_probe(struct platform_device *pdev)
>  			GFP_KERNEL);
>  
>  	if (mcspi->dma_channels == NULL)
> -		goto err2;
> +		goto unmap_io;
>  
>  	for (i = 0; i < master->num_chipselect; i++) {
>  		char dma_ch_name[14];
> @@ -1181,26 +1181,33 @@ static int __init omap2_mcspi_probe(struct platform_device *pdev)
>  		mcspi->dma_channels[i].dma_tx_sync_dev = dma_res->start;
>  	}
>  
> +	if (status < 0)
> +		goto dma_chnl_free;
> +
>  	pm_runtime_enable(&pdev->dev);
>  
>  	if (status || omap2_mcspi_master_setup(mcspi) < 0)
> -		goto err3;
> +		goto disable_pm;
>  
>  	status = spi_register_master(master);
>  	if (status < 0)
> -		goto err4;
> +		goto err_spi_register;
>  
>  	return status;
>  
> -err4:
> +err_spi_register:
>  	spi_master_put(master);
> -err3:
> +disable_pm:
>  	pm_runtime_disable(&pdev->dev);
> +dma_chnl_free:
>  	kfree(mcspi->dma_channels);
> -err2:
> -	release_mem_region(r->start, resource_size(r));
> +unmap_io:
>  	iounmap(mcspi->base);
> -err1:
> +release_region:
> +	release_mem_region(r->start, resource_size(r));
> +free_master:
> +	kfree(master);
> +	platform_set_drvdata(pdev, NULL);
>  	return status;
>  }
>  
> @@ -1226,6 +1233,7 @@ static int __exit omap2_mcspi_remove(struct platform_device *pdev)
>  	iounmap(base);
>  	kfree(dma_channels);
>  	destroy_workqueue(mcspi->wq);
> +	platform_set_drvdata(pdev, NULL);
>  
>  	return 0;
>  }
> -- 
> 1.7.1
> 
> 
> ------------------------------------------------------------------------------
> The demand for IT networking professionals continues to grow, and the
> demand for specialized networking skills is growing even more rapidly.
> Take a complimentary Learning@Cisco Self-Assessment and learn 
> about Cisco certifications, training, and career opportunities. 
> http://p.sf.net/sfu/cisco-dev2dev
> _______________________________________________
> spi-devel-general mailing list
> spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
> https://lists.sourceforge.net/lists/listinfo/spi-devel-general

------------------------------------------------------------------------------
Get your Android app more play: Bring it to the BlackBerry PlayBook 
in minutes. BlackBerry App World&#153; now supports Android&#153; Apps 
for the BlackBerry&reg; PlayBook&#153;. Discover just how easy and simple 
it is! http://p.sf.net/sfu/android-dev2dev

      parent reply	other threads:[~2011-10-29 12:07 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-28 11:44 [PATCH 0/3] OMAP: SPI: Driver updates Shubhrajyoti D
     [not found] ` <1319802259-16565-1-git-send-email-shubhrajyoti-l0cyMroinI0@public.gmane.org>
2011-10-28 11:44   ` [PATCH 1/3] OMAP: SPI: Use a workqueue per omap2_mcspi controller Shubhrajyoti D
2011-10-29 12:03     ` Grant Likely
2011-10-28 11:44   ` [PATCH 2/3] OMAP: SPI: call pm_runtime_disable in error path and remove Shubhrajyoti D
2011-10-29 12:06     ` Grant Likely
     [not found]       ` <20111029120655.GE22592-e0URQFbLeQY2iJbIjFUEsiwD8/FfD2ys@public.gmane.org>
2011-10-31  5:16         ` Shubhrajyoti
2011-10-28 11:44   ` [PATCH 3/3] OMAP: SPI: Correct the error path Shubhrajyoti D
     [not found]     ` <1319802259-16565-4-git-send-email-shubhrajyoti-l0cyMroinI0@public.gmane.org>
2011-10-29 12:07       ` Grant Likely [this message]

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=20111029120709.GF22592@ponder.secretlab.ca \
    --to=grant.likely-s3s/wqlpoipyb63q8fvjnq@public.gmane.org \
    --cc=gururaja.hebbar-l0cyMroinI0@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=shubhrajyoti-l0cyMroinI0@public.gmane.org \
    --cc=spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    /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: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).