lkml.org 
[lkml]   [2007]   [Dec]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[PATCH] pktcdvd : add kobject_put when kobject register fails
    Kobject_put should be called when kobject register functioin fails, so the the kobj ref count touch zero and then the proper cleanup routines will be called.

    Signed-off-by: Dave Young <hidave.darkstar@gmail.com>

    ---
    drivers/block/pktcdvd.c | 4 +++-
    1 file changed, 3 insertions(+), 1 deletion(-)

    diff -upr linux/drivers/block/pktcdvd.c linux.new/drivers/block/pktcdvd.c
    --- linux/drivers/block/pktcdvd.c 2007-11-30 13:13:44.000000000 +0800
    +++ linux.new/drivers/block/pktcdvd.c 2007-11-30 13:24:08.000000000 +0800
    @@ -117,8 +117,10 @@ static struct pktcdvd_kobj* pkt_kobj_cre
    p->kobj.parent = parent;
    p->kobj.ktype = ktype;
    p->pd = pd;
    - if (kobject_register(&p->kobj) != 0)
    + if (kobject_register(&p->kobj) != 0) {
    + kobject_put(&p->kobj);
    return NULL;
    + }
    return p;
    }
    /*

    \
     
     \ /
      Last update: 2007-12-04 02:33    [W:0.025 / U:0.660 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site