Re: [-mm3 PATCH] (Retry) Check the return value of kobject_add andetc.

From: Cornelia Huck
Date: Thu Apr 05 2007 - 11:58:35 EST


On Thu, 5 Apr 2007 23:27:32 +0800,
WANG Cong <xiyou.wangcong@xxxxxxxxx> wrote:

> Thank you very much! I know. So I should replace all kfree with kobject_put, like this one:
>
> - sysfs_create_link(&p->kobj, &block_subsys.kset.kobj, "subsystem");
> + if (sysfs_create_link(&p->kobj, &block_subsys.kset.kobj, "subsystem")) {
> + kobject_uevent(&p->kobj, KOBJ_REMOVE);
> + kobject_del(&p->kobj);
> + kobject_put(&p->kobj);
> + return;
> + }
>
> Is that all right?
>

Yes, or use kobject_unregister().
-
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/