[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20080103161429.59cea05d@gondolin.boeblingen.de.ibm.com>
Date: Thu, 3 Jan 2008 16:14:29 +0100
From: Cornelia Huck <cornelia.huck@...ibm.com>
To: Greg KH <greg@...ah.com>
Cc: linux-kernel@...r.kernel.org, Kay Sievers <kay.sievers@...y.org>,
Alan Stern <stern@...land.harvard.edu>,
Jonathan Corbet <corbet@....net>,
Randy Dunlap <randy.dunlap@...cle.com>
Subject: Re: [RFC] sample kset/ktype/kobject implementation code
On Wed, 19 Dec 2007 16:31:35 -0800,
Greg KH <greg@...ah.com> 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 majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists