linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] OMAP: SPI: Fix the trying to free nonexistent resource error
@ 2011-10-24 10:24 Shubhrajyoti D
  2011-10-24 11:45 ` Grant Likely
  0 siblings, 1 reply; 2+ messages in thread
From: Shubhrajyoti D @ 2011-10-24 10:24 UTC (permalink / raw)
  To: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
  Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA, Shubhrajyoti D

Currently there is a request_mem_region(r->start, ..
followed by r->start += pdata->regs_offset;

And then in remove

   r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
   release_mem_region(r->start, resource_size(r));

Here the offset addition is not taken care. Fix the code for the
same.

Signed-off-by: Shubhrajyoti D <shubhrajyoti-l0cyMroinI0@public.gmane.org>
---
 drivers/spi/spi-omap2-mcspi.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c
index 06dc9a9..471b0f3 100644
--- a/drivers/spi/spi-omap2-mcspi.c
+++ b/drivers/spi/spi-omap2-mcspi.c
@@ -1123,15 +1123,15 @@ static int __init omap2_mcspi_probe(struct platform_device *pdev)
 		status = -ENODEV;
 		goto err1;
 	}
+	r->start += pdata->regs_offset;
+	r->end += pdata->regs_offset;
+	mcspi->phys = r->start;
 	if (!request_mem_region(r->start, resource_size(r),
 				dev_name(&pdev->dev))) {
 		status = -EBUSY;
 		goto err1;
 	}
 
-	r->start += pdata->regs_offset;
-	r->end += pdata->regs_offset;
-	mcspi->phys = r->start;
 	mcspi->base = ioremap(r->start, resource_size(r));
 	if (!mcspi->base) {
 		dev_dbg(&pdev->dev, "can't ioremap MCSPI\n");
-- 
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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] OMAP: SPI: Fix the trying to free nonexistent resource error
  2011-10-24 10:24 [PATCH] OMAP: SPI: Fix the trying to free nonexistent resource error Shubhrajyoti D
@ 2011-10-24 11:45 ` Grant Likely
  0 siblings, 0 replies; 2+ messages in thread
From: Grant Likely @ 2011-10-24 11:45 UTC (permalink / raw)
  To: Shubhrajyoti D; +Cc: spi-devel-general, linux-kernel, stable

On Mon, Oct 24, 2011 at 03:54:24PM +0530, Shubhrajyoti D wrote:
> Currently there is a request_mem_region(r->start, ..
> followed by r->start += pdata->regs_offset;
> 
> And then in remove
> 
>    r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>    release_mem_region(r->start, resource_size(r));
> 
> Here the offset addition is not taken care. Fix the code for the
> same.
> 
> Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com>

Applied, thanks.

g.

> ---
>  drivers/spi/spi-omap2-mcspi.c |    6 +++---
>  1 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c
> index 06dc9a9..471b0f3 100644
> --- a/drivers/spi/spi-omap2-mcspi.c
> +++ b/drivers/spi/spi-omap2-mcspi.c
> @@ -1123,15 +1123,15 @@ static int __init omap2_mcspi_probe(struct platform_device *pdev)
>  		status = -ENODEV;
>  		goto err1;
>  	}
> +	r->start += pdata->regs_offset;
> +	r->end += pdata->regs_offset;
> +	mcspi->phys = r->start;
>  	if (!request_mem_region(r->start, resource_size(r),
>  				dev_name(&pdev->dev))) {
>  		status = -EBUSY;
>  		goto err1;
>  	}
>  
> -	r->start += pdata->regs_offset;
> -	r->end += pdata->regs_offset;
> -	mcspi->phys = r->start;
>  	mcspi->base = ioremap(r->start, resource_size(r));
>  	if (!mcspi->base) {
>  		dev_dbg(&pdev->dev, "can't ioremap MCSPI\n");
> -- 
> 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@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/spi-devel-general

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-10-24 11:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-24 10:24 [PATCH] OMAP: SPI: Fix the trying to free nonexistent resource error Shubhrajyoti D
2011-10-24 11:45 ` Grant Likely

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).