Thread (43 messages) 43 messages, 7 authors, 2012-08-01

[06/10,V2] spi: Add SPI driver for mx233/mx28

From: Lothar Waßmann <hidden>
Date: 2012-08-01 07:38:07
Also in: linux-spi

Shawn Guo writes:
On Wed, Aug 01, 2012 at 08:45:19AM +0200, Marek Vasut wrote:
quoted
quoted
I must be missing something.  Why do almost all spi drivers call it in the
error path, even if there is no call to spi_master_get ?
To push the refcounting to 0, to deallocate the device, I'd say ...
It's not going to work if spi_master_put is called without
spi_master_get being called before that.
spi_alloc_master() calls device_initialize() which resuires a
device_put() (called from spi_master_put()) to free the device.

Thus each call of either spi_alloc_master() or spi_master_get() must
be paired with an spi_master_put() call to free the resources.

The kfree() is taken care of by the spi_master_release() function that
is called once the last reference to the underlying struct device has
been released. Thus kfree() must not be called after
spi_alloc_master().


Lothar Wa?mann
-- 
___________________________________________________________

Ka-Ro electronics GmbH | Pascalstra?e 22 | D - 52076 Aachen
Phone: +49 2408 1402-0 | Fax: +49 2408 1402-10
Gesch?ftsf?hrer: Matthias Kaussen
Handelsregistereintrag: Amtsgericht Aachen, HRB 4996

www.karo-electronics.de | info at karo-electronics.de
___________________________________________________________
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help