Re: [PATCH] x86: mcheck: call put_device on device_register failure

From: Borislav Petkov
Date: Sat Nov 30 2013 - 06:12:35 EST


On Sat, Nov 30, 2013 at 08:30:33AM +0100, Levente Kurusa wrote:
> No, if the call to put_device gives up the last reference to the
> device, then device_release gets called which in turn frees the memory
> associated with it. In this case, mce_device_release() will get
> called, which is just a simple kfree call.

Aah, that's that delayed freeing the driver core does, right. Now you
made me go and look into detail:

device_unregister
|->put_device
|->kobject_put
|->kref_put(&kobj->kref, kobject_release)
|->kref_sub(kref, 1, release)
|->release
|->kobject_release
|->kobject_cleanup
|->t->release
|->device_release
|->mce_device_release


Ok, I see it now. :-) :-)

Thanks, I'll take your patch as-is.

--
Regards/Gruss,
Boris.

Sent from a fat crate under my desk. Formatting is fine.
--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/