lkml.org 
[lkml]   [2004]   [Apr]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [RFC 1/2] kobject_set_name - error handling
Date
On Friday 30 April 2004 05:14 am, Maneesh Soni wrote:

> diff -puN drivers/base/bus.c~kobject_set_name-cleanup-01 drivers/base/bus.c
> --- linux-2.6.6-rc2-mm2/drivers/base/bus.c~kobject_set_name-cleanup-01 2004-04-30 15:14:03.000000000 +0530
> +++ linux-2.6.6-rc2-mm2-maneesh/drivers/base/bus.c 2004-04-30 15:14:03.000000000 +0530
> @@ -451,7 +451,9 @@ int bus_add_driver(struct device_driver
>
> if (bus) {
> pr_debug("bus %s: add driver %s\n",bus->name,drv->name);
> - kobject_set_name(&drv->kobj,drv->name);
> + error = kobject_set_name(&drv->kobj,drv->name);
> + if (error)
> + return error;

Hi, I think you are leaking a reference here, put_bus() is needed.

> drv->kobj.kset = &bus->drivers;
> if ((error = kobject_register(&drv->kobj))) {
> put_bus(bus);

--
Dmitry
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 14:02    [W:0.107 / U:5.964 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site