public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Eugene Teo <eugeneteo@kernel.sg>
To: Cornelia Huck <cornelia.huck@de.ibm.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] fs/partitions/check.c: add_partition() warning fixes (take 2)
Date: Mon, 30 Jul 2007 18:49:04 +0800	[thread overview]
Message-ID: <46ADC220.1090703@kernel.sg> (raw)
In-Reply-To: <20070730123045.4a3f859c@gondolin.boeblingen.de.ibm.com>

Cornelia Huck wrote:
> On Mon, 30 Jul 2007 17:47:55 +0800,
> Eugene Teo <eugeneteo@kernel.sg> wrote:
> 
>> +err_out_del_link:
>> +	sysfs_remove_link(&p->kobj, "subsystem");
>> +err_out_del_kobj:
>> +	if (!disk->part_uevent_suppress)
>> +		kobject_uevent(&p->kobj, KOBJ_REMOVE);
>> +	kobject_put(&p->kobj);
>> +err_out:
>> +	kfree(p);
>>  }
> 
> No, this is wrong. You need to move the put behind err_out and remove
> the kfree. (The release function will take care of p.)

503 void kobject_put(struct kobject * kobj)
504 {
505         if (kobj)
506                 kref_put(&kobj->kref, kobject_release);
[...]
 52 int kref_put(struct kref *kref, void (*release)(struct kref *kref))
 53 {
[...]
 57         if (atomic_dec_and_test(&kref->refcount)) {
 58                 release(kref);
 59                 return 1;

Nod, thanks for your guidance.

Eugene

      reply	other threads:[~2007-07-30 10:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-30  9:47 [PATCH] fs/partitions/check.c: add_partition() warning fixes (take 2) Eugene Teo
2007-07-30 10:30 ` Cornelia Huck
2007-07-30 10:49   ` Eugene Teo [this message]

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=46ADC220.1090703@kernel.sg \
    --to=eugeneteo@kernel.sg \
    --cc=cornelia.huck@de.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    /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