mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "James C. Georgas" <jgeorgas@rogers.com>
To: "Randy.Dunlap" <rdunlap@xenotime.net>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Freeing a dynamic struct cdev
Date: Sat, 06 Aug 2005 22:47:04 -0400	[thread overview]
Message-ID: <1123382825.15705.18.camel@Tachyon.home> (raw)
In-Reply-To: <20050806155958.5f3092bc.rdunlap@xenotime.net>

Ok, I really blew it with that last post:

> 
> cdev_add() calls:
> 	kobj_map()
> 	kobject_get() [indirectly]
> 

This is wrong. When I first looked at it, I saw:

cdev_add() -> kobj_map() -> exact_lock() -> cdev_get() -> kobject_get()

but exact_lock() isn't called here; it is only passed as a function
pointer to kobj_map(), and so calling cdev_add() does /not/ increment
the reference count of the struct cdev.

I guess what threw me for a loop here was that I was expecting separate
functions: one to undo cdev_add() and one to undo cdev_alloc(), but
cdev_del() accomplishes both tasks in one function, with the
kobj_unmap() part having no effect, if the cdev is not mapped at the
time of the call.

-- 
James C. Georgas <jgeorgas@rogers.com>


      parent reply	other threads:[~2005-08-07  2:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-06 13:26 James C. Georgas
2005-08-06 19:21 ` Randy.Dunlap
2005-08-06 19:26   ` James C. Georgas
2005-08-06 19:28     ` Randy.Dunlap
     [not found]       ` <1123362724.13845.11.camel@Tachyon.home>
     [not found]         ` <20050806155958.5f3092bc.rdunlap@xenotime.net>
2005-08-07  2:47           ` James C. Georgas [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=1123382825.15705.18.camel@Tachyon.home \
    --to=jgeorgas@rogers.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rdunlap@xenotime.net \
    /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®