On Wed, 19 Dec 2007 16:31:35 -0800, Greg KH <[EMAIL PROTECTED]> wrote:
> /* > * Initialize and add the kobject to the kernel. All the default files > * will be created here. As we have already specified a kset for this > * kobject, we don't have to set a parent for the kobject, the kobject > * will be placed beneath that kset automatically. > */ > retval = kobject_init_and_add(&foo->kobj, &foo_ktype, NULL, "%s", name); > if (retval) { > kfree(foo); > return NULL; > } I really hate to say this, but the example is still wrong. There needs to be a kobject_put(&foo->kobj) instead of the kfree(foo) (as the comments for kobject_init_and_add() resp. kobject_add_ng() correctly explain :)) -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/