All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Daney <ddaney@caviumnetworks.com>
To: Guenter Roeck <linux@roeck-us.net>
Cc: David Daney <ddaney.cavm@gmail.com>,
	<devicetree-discuss@lists.ozlabs.org>,
	Grant Likely <grant.likely@secretlab.ca>,
	Rob Herring <rob.herring@calxeda.com>,
	<spi-devel-general@lists.sourceforge.net>,
	<linux-kernel@vger.kernel.org>, <linux-mips@linux-mips.org>,
	<linux-doc@vger.kernel.org>, David Daney <david.daney@cavium.com>
Subject: Re: [2/2] spi: Add SPI master controller for OCTEON SOCs.
Date: Tue, 21 Aug 2012 13:38:02 -0700	[thread overview]
Message-ID: <5033F1AA.4080308@caviumnetworks.com> (raw)
In-Reply-To: <20120821194936.GA7145@roeck-us.net>

On 08/21/2012 12:49 PM, Guenter Roeck wrote:
> On Fri, May 11, 2012 at 08:34:46PM -0000, David Daney wrote:
>> From: David Daney <david.daney@cavium.com>
>>
>> Add the driver, link it into the kbuild system and provide device tree
>> binding documentation.
>>
>> Signed-off-by: David Daney <david.daney@cavium.com>
>> Acked-by: Grant Likely <grant.likely@secretlab.ca>
>>
> [ ... ]
>
>> +
>> +static int __devexit octeon_spi_remove(struct platform_device *pdev)
>> +{
>> +	struct octeon_spi *p = platform_get_drvdata(pdev);
>> +	struct spi_master *master = p->my_master;
>> +
>> +	spi_unregister_master(master);
>> +
>
> I know it is a bit late, but ...

In this case, just in time.  I am now finally getting back to fixing the 
issues with this driver, and looking to merging it in the near future.

David Daney

>
> The call to spi_unregister_master() frees the memory associated with master,
> ie 'p', and the spi_master_put() below without matching spi_master_get() is
> unnecessary/wrong. One possible fix would be to use
>
> 	struct spi_master *master = spi_master_get(p->my_master);
>
> above. That protects master and p while it is still being used, and makes use
> of the call to spi_master_put() below. Another option might be to move
> cvmx_write_csr() ahead of the call to spi_unregister_master() and drop the
> call to spi_master_put().
>
> Guenter
>
>> +	/* Clear the CSENA* and put everything in a known state. */
>> +	cvmx_write_csr(p->register_base + OCTEON_SPI_CFG, 0);
>> +	spi_master_put(master);
>> +	return 0;
>> +}
>> +
>

WARNING: multiple messages have this Message-ID (diff)
From: David Daney <ddaney@caviumnetworks.com>
To: Guenter Roeck <linux@roeck-us.net>
Cc: David Daney <ddaney.cavm@gmail.com>,
	devicetree-discuss@lists.ozlabs.org,
	Grant Likely <grant.likely@secretlab.ca>,
	Rob Herring <rob.herring@calxeda.com>,
	spi-devel-general@lists.sourceforge.net,
	linux-kernel@vger.kernel.org, linux-mips@linux-mips.org,
	linux-doc@vger.kernel.org, David Daney <david.daney@cavium.com>
Subject: Re: [2/2] spi: Add SPI master controller for OCTEON SOCs.
Date: Tue, 21 Aug 2012 13:38:02 -0700	[thread overview]
Message-ID: <5033F1AA.4080308@caviumnetworks.com> (raw)
Message-ID: <20120821203802.6cUOgbHlTfOjmxnHkq63plnTV5IiC3Ku_OcwpVmui-s@z> (raw)
In-Reply-To: <20120821194936.GA7145@roeck-us.net>

On 08/21/2012 12:49 PM, Guenter Roeck wrote:
> On Fri, May 11, 2012 at 08:34:46PM -0000, David Daney wrote:
>> From: David Daney <david.daney@cavium.com>
>>
>> Add the driver, link it into the kbuild system and provide device tree
>> binding documentation.
>>
>> Signed-off-by: David Daney <david.daney@cavium.com>
>> Acked-by: Grant Likely <grant.likely@secretlab.ca>
>>
> [ ... ]
>
>> +
>> +static int __devexit octeon_spi_remove(struct platform_device *pdev)
>> +{
>> +	struct octeon_spi *p = platform_get_drvdata(pdev);
>> +	struct spi_master *master = p->my_master;
>> +
>> +	spi_unregister_master(master);
>> +
>
> I know it is a bit late, but ...

In this case, just in time.  I am now finally getting back to fixing the 
issues with this driver, and looking to merging it in the near future.

David Daney

>
> The call to spi_unregister_master() frees the memory associated with master,
> ie 'p', and the spi_master_put() below without matching spi_master_get() is
> unnecessary/wrong. One possible fix would be to use
>
> 	struct spi_master *master = spi_master_get(p->my_master);
>
> above. That protects master and p while it is still being used, and makes use
> of the call to spi_master_put() below. Another option might be to move
> cvmx_write_csr() ahead of the call to spi_unregister_master() and drop the
> call to spi_master_put().
>
> Guenter
>
>> +	/* Clear the CSENA* and put everything in a known state. */
>> +	cvmx_write_csr(p->register_base + OCTEON_SPI_CFG, 0);
>> +	spi_master_put(master);
>> +	return 0;
>> +}
>> +
>

  reply	other threads:[~2012-08-21 20:38 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-11 21:34 [PATCH 0/2] MIPS/spi: New driver for SPI master controller for OCTEON SOCs David Daney
2012-05-11 21:34 ` [PATCH 1/2] MIPS: OCTEON: Add register definitions for SPI host hardware David Daney
2012-05-11 21:34   ` David Daney
2012-05-14 20:02   ` Linus Walleij
2012-05-20  5:23   ` Grant Likely
2012-05-20  5:23     ` Grant Likely
2012-08-21 18:23   ` John Crispin
2012-05-11 21:34 ` [PATCH 2/2] spi: Add SPI master controller for OCTEON SOCs David Daney
2012-05-11 21:34   ` David Daney
2012-05-14  5:46   ` Shubhrajyoti Datta
2012-05-14 18:13     ` David Daney
2012-05-20  5:26       ` Grant Likely
2012-05-20  5:26         ` Grant Likely
2012-05-20  5:26         ` Grant Likely
2012-05-14 20:07   ` Linus Walleij
2012-05-14 20:07     ` Linus Walleij
2012-05-20  5:46   ` Grant Likely
2012-08-21 19:30     ` David Daney
2012-08-21 19:30       ` David Daney
2012-08-21 18:23   ` John Crispin
2012-08-21 18:33     ` David Daney
2012-08-21 18:35       ` John Crispin
2012-08-21 18:40         ` David Daney
2012-08-21 18:40           ` John Crispin
2012-08-21 19:49   ` [2/2] " Guenter Roeck
2012-08-21 19:49     ` Guenter Roeck
2012-08-21 20:38     ` David Daney [this message]
2012-08-21 20:38       ` David Daney

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=5033F1AA.4080308@caviumnetworks.com \
    --to=ddaney@caviumnetworks.com \
    --cc=david.daney@cavium.com \
    --cc=ddaney.cavm@gmail.com \
    --cc=devicetree-discuss@lists.ozlabs.org \
    --cc=grant.likely@secretlab.ca \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@linux-mips.org \
    --cc=linux@roeck-us.net \
    --cc=rob.herring@calxeda.com \
    --cc=spi-devel-general@lists.sourceforge.net \
    /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 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.