diff options
author | Dave Young <hidave.darkstar@gmail.com> | 2007-12-17 19:20:00 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-12-17 22:28:16 -0500 |
commit | d17a18dd92c91c784fcf7c785fa6bbf178fd0a6d (patch) | |
tree | b30a69a515dc3d183ff8ce0074433d6e6cfa2305 | |
parent | bbd0682596f7a434467ee551fee18d5f0b818539 (diff) |
pktcdvd: add kobject_put when kobject register fails
In kobject_register, the kobject reference is get in kobject_init, and then
kobject_add. If kobject_add fail, it will only cleanup the reference got
by itself.
Signed-off-by: Dave Young <hidave.darkstar@gmail.com>
Reviewed-by: Pekka Enberg <penberg@cs.helsinki.fi>
Cc: Greg KH <greg@kroah.com>
Cc: Peter Osterlund <petero2@telia.com>
Cc: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | drivers/block/pktcdvd.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c index a5ee21319d37..3535ef896677 100644 --- a/drivers/block/pktcdvd.c +++ b/drivers/block/pktcdvd.c | |||
@@ -117,8 +117,10 @@ static struct pktcdvd_kobj* pkt_kobj_create(struct pktcdvd_device *pd, | |||
117 | p->kobj.parent = parent; | 117 | p->kobj.parent = parent; |
118 | p->kobj.ktype = ktype; | 118 | p->kobj.ktype = ktype; |
119 | p->pd = pd; | 119 | p->pd = pd; |
120 | if (kobject_register(&p->kobj) != 0) | 120 | if (kobject_register(&p->kobj) != 0) { |
121 | kobject_put(&p->kobj); | ||
121 | return NULL; | 122 | return NULL; |
123 | } | ||
122 | return p; | 124 | return p; |
123 | } | 125 | } |
124 | /* | 126 | /* |