linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] spi: Fix WARN when removing spi-fsl-spi module
@ 2011-09-23 15:49 Jeff Harris
  2011-09-23 23:29 ` Grant Likely
  0 siblings, 1 reply; 2+ messages in thread
From: Jeff Harris @ 2011-09-23 15:49 UTC (permalink / raw)
  To: Grant Likely, spi-devel-general; +Cc: linux-kernel, Jeff Harris

If CPM mode is not used, the fsl_dummy_rx variable is never allocated.  When
the cleanup attempts to free it, the reference count is zero and a WARN is
generated.  The same CPM mode check used in the initialize is applied to the
free as well.

Tested on 2.6.33 with the previous spi_mpc8xxx driver.  The renamed
spi-fsl-spi driver looks to have the same problem.

Signed-off-by: Jeff Harris <jeff_harris@kentrox.com>
---
 drivers/spi/spi-fsl-spi.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/drivers/spi/spi-fsl-spi.c b/drivers/spi/spi-fsl-spi.c
index d240755..24cacff 100644
--- a/drivers/spi/spi-fsl-spi.c
+++ b/drivers/spi/spi-fsl-spi.c
@@ -825,6 +825,9 @@ static void fsl_spi_cpm_free(struct mpc8xxx_spi *mspi)
 {
 	struct device *dev = mspi->dev;
 
+	if (!(mspi->flags & SPI_CPM_MODE))
+		return;
+
 	dma_unmap_single(dev, mspi->dma_dummy_rx, SPI_MRBLR, DMA_FROM_DEVICE);
 	dma_unmap_single(dev, mspi->dma_dummy_tx, PAGE_SIZE, DMA_TO_DEVICE);
 	cpm_muram_free(cpm_muram_offset(mspi->tx_bd));
-- 
1.7.0.5

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

* Re: [PATCH] spi: Fix WARN when removing spi-fsl-spi module
  2011-09-23 15:49 [PATCH] spi: Fix WARN when removing spi-fsl-spi module Jeff Harris
@ 2011-09-23 23:29 ` Grant Likely
  0 siblings, 0 replies; 2+ messages in thread
From: Grant Likely @ 2011-09-23 23:29 UTC (permalink / raw)
  To: Jeff Harris; +Cc: spi-devel-general, linux-kernel

On Fri, Sep 23, 2011 at 11:49:36AM -0400, Jeff Harris wrote:
> If CPM mode is not used, the fsl_dummy_rx variable is never allocated.  When
> the cleanup attempts to free it, the reference count is zero and a WARN is
> generated.  The same CPM mode check used in the initialize is applied to the
> free as well.
> 
> Tested on 2.6.33 with the previous spi_mpc8xxx driver.  The renamed
> spi-fsl-spi driver looks to have the same problem.
> 
> Signed-off-by: Jeff Harris <jeff_harris@kentrox.com>

Merged, thanks.

g.

> ---
>  drivers/spi/spi-fsl-spi.c |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/spi/spi-fsl-spi.c b/drivers/spi/spi-fsl-spi.c
> index d240755..24cacff 100644
> --- a/drivers/spi/spi-fsl-spi.c
> +++ b/drivers/spi/spi-fsl-spi.c
> @@ -825,6 +825,9 @@ static void fsl_spi_cpm_free(struct mpc8xxx_spi *mspi)
>  {
>  	struct device *dev = mspi->dev;
>  
> +	if (!(mspi->flags & SPI_CPM_MODE))
> +		return;
> +
>  	dma_unmap_single(dev, mspi->dma_dummy_rx, SPI_MRBLR, DMA_FROM_DEVICE);
>  	dma_unmap_single(dev, mspi->dma_dummy_tx, PAGE_SIZE, DMA_TO_DEVICE);
>  	cpm_muram_free(cpm_muram_offset(mspi->tx_bd));
> -- 
> 1.7.0.5
> 

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

end of thread, other threads:[~2011-09-23 23:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-23 15:49 [PATCH] spi: Fix WARN when removing spi-fsl-spi module Jeff Harris
2011-09-23 23:29 ` 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).