On Tue, Jul 31, 2012 at 01:53:00PM -0700, Guenter Roeck wrote:
> > +   spi_master_put(host);
> > +   kfree(host);
> > +
> 
> Is the kfree() here and in the probe function really necessary ? 
> 
The following is how the kerneldoc of spi_alloc_master says.

 * The caller is responsible for assigning the bus number and initializing
 * the master's methods before calling spi_register_master(); and (after errors
 * adding the device) calling spi_master_put() and kfree() to prevent a memory
 * leak.

> Couple of reasons for asking: No other SPI master driver calls it in the 
> remove
> function (unless I missed it), most drivers don't call it in the probe
> function error path, and if I call it in the remove function in a SPI master
> driver I am working on, and load/unload the module several times in a row, I 
> get
> a nasty kernel crash.
> 
So sounds like either code or the kerneldoc needs patching?

Regards,
Shawn


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general

Reply via email to