Re: Oops involving RFCOMM and sysfs

Cornelia Huck <[email protected]>
Newsgroups gmane.linux.bluez.devel
Organization IBM Deutschland Entwicklung GmbH Vorsitzender des Aufsichtsrats: Martin Jetter Geschäftsführung: Herbert Kircher Sitz der Gesellschaft: Böblingen Registergericht: Amtsgericht Stuttgart, HRB 243294
Message-ID <20080118112337.0b457c49__4814.64988920397$1200684504$gmane$org@gondolin.boeblingen.de.ibm.com>
On Fri, 18 Jan 2008 10:19:33 +0100,
Cornelia Huck <[email protected]> wrote:

> > 
> > 1314         if (IS_ERR(new_parent_kobj)) {
> > 1315                 error = PTR_ERR(new_parent_kobj);
> > 1316                 put_device(new_parent);
> > 1317                 goto out;
> > 1318         }
> > 1319         pr_debug("DEVICE: moving '%s' to '%s'\n", dev->bus_id,
> > 1320                  new_parent ? new_parent->bus_id : "<NULL>");
> > 1321         error = kobject_move(&dev->kobj, new_parent_kobj);
> > 1322         if (error) {
> > 1323                 put_device(new_parent);
> > 
> > imagine new_parent is NULL, then the new_parent_kobj should be put
> 
> No, we would need a put_device_parent() (crappy name) which puts the
> reference iff get_device_parent() grabbed it.

And looking at Greg's patchset, it has cleanup_device_parent(), which
does just that. But it is only called in device_del(), not when
device_move() has errors.

(get_device_parent() also always returns a pointer to a kobject or
NULL, so we can get rid of those IS_ERR() checks in setup_parent() and
device_move() as well.)

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.