mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Cornelia Huck <cornelia.huck@de.ibm.com>
To: Greg KH <greg@kroah.com>
Cc: linux-kernel@vger.kernel.org, Kay Sievers <kay.sievers@vrfy.org>,
	Alan Stern <stern@rowland.harvard.edu>,
	Jonathan Corbet <corbet@lwn.net>,
	Randy Dunlap <randy.dunlap@oracle.com>
Subject: Re: [RFC] sample kset/ktype/kobject implementation code
Date: Thu, 3 Jan 2008 16:14:29 +0100	[thread overview]
Message-ID: <20080103161429.59cea05d@gondolin.boeblingen.de.ibm.com> (raw)
In-Reply-To: <20071220003135.GC15129@kroah.com>

On Wed, 19 Dec 2007 16:31:35 -0800,
Greg KH <greg@kroah.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 :))

  reply	other threads:[~2008-01-03 15:15 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-20  0:30 [RFC] kobject/kset/ktype documentation and example code updated Greg KH
2007-12-20  0:31 ` [RFC] sample kobject implementation code Greg KH
2007-12-20  0:31 ` [RFC] sample kset/ktype/kobject " Greg KH
2008-01-03 15:14   ` Cornelia Huck [this message]
2007-12-20  4:26 ` [RFC] kobject/kset/ktype documentation and example code updated Alan Stern
2007-12-20  7:27   ` Kay Sievers
2007-12-20 21:48   ` Greg KH
2007-12-20  6:32 ` Randy Dunlap
2007-12-20 21:27   ` Greg KH
2007-12-20 22:03     ` Robert P. J. Day
2007-12-20 22:20       ` Greg KH
2007-12-20 22:06     ` Randy Dunlap
2007-12-20 22:12       ` Greg KH
2007-12-20 22:29         ` Randy Dunlap
2007-12-20 22:42           ` Greg KH
2007-12-20 22:48             ` Randy Dunlap
2007-12-20 22:57     ` Alan Stern
2007-12-20  7:54 ` Dave Young
2007-12-20  8:02   ` Greg KH
2007-12-20  9:04 ` Jan Engelhardt
2007-12-20 21:16   ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080103161429.59cea05d@gondolin.boeblingen.de.ibm.com \
    --to=cornelia.huck@de.ibm.com \
    --cc=corbet@lwn.net \
    --cc=greg@kroah.com \
    --cc=kay.sievers@vrfy.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=randy.dunlap@oracle.com \
    --cc=stern@rowland.harvard.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®