diff mbox

[net-next] bonding: use kobject_put instead of _del after kobject_add

Message ID 1406633263-2115-1-git-send-email-vfalico@gmail.com
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Veaceslav Falico July 29, 2014, 11:27 a.m. UTC
Otherwise the name of the kobject isn't getting freed and other stuff from
kobject_cleanup() isn't getting called. kobject_put() will call
kobject_del() on its own in kobject_cleanup().

CC: Jay Vosburgh <j.vosburgh@gmail.com>
CC: Andy Gospodarek <andy@greyhouse.net>
Signed-off-by: Veaceslav Falico <vfalico@gmail.com>
---
 drivers/net/bonding/bond_sysfs_slave.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

David Miller July 31, 2014, 12:37 a.m. UTC | #1
From: Veaceslav Falico <vfalico@gmail.com>
Date: Tue, 29 Jul 2014 13:27:43 +0200

> Otherwise the name of the kobject isn't getting freed and other stuff from
> kobject_cleanup() isn't getting called. kobject_put() will call
> kobject_del() on its own in kobject_cleanup().
> 
> CC: Jay Vosburgh <j.vosburgh@gmail.com>
> CC: Andy Gospodarek <andy@greyhouse.net>
> Signed-off-by: Veaceslav Falico <vfalico@gmail.com>

Introduced in v3.14, so maybe steer this to 'net' instead?
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Veaceslav Falico July 31, 2014, 10:46 a.m. UTC | #2
On Wed, Jul 30, 2014 at 05:37:43PM -0700, David Miller wrote:
>From: Veaceslav Falico <vfalico@gmail.com>
>Date: Tue, 29 Jul 2014 13:27:43 +0200
>
>> Otherwise the name of the kobject isn't getting freed and other stuff from
>> kobject_cleanup() isn't getting called. kobject_put() will call
>> kobject_del() on its own in kobject_cleanup().
>>
>> CC: Jay Vosburgh <j.vosburgh@gmail.com>
>> CC: Andy Gospodarek <andy@greyhouse.net>
>> Signed-off-by: Veaceslav Falico <vfalico@gmail.com>
>
>Introduced in v3.14, so maybe steer this to 'net' instead?

Good idea. Should I re-send it or can you just apply it to net?
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller July 31, 2014, 6:16 p.m. UTC | #3
From: Veaceslav Falico <vfalico@gmail.com>
Date: Thu, 31 Jul 2014 12:46:01 +0200

> On Wed, Jul 30, 2014 at 05:37:43PM -0700, David Miller wrote:
>>From: Veaceslav Falico <vfalico@gmail.com>
>>Date: Tue, 29 Jul 2014 13:27:43 +0200
>>
>>> Otherwise the name of the kobject isn't getting freed and other stuff
>>> from
>>> kobject_cleanup() isn't getting called. kobject_put() will call
>>> kobject_del() on its own in kobject_cleanup().
>>>
>>> CC: Jay Vosburgh <j.vosburgh@gmail.com>
>>> CC: Andy Gospodarek <andy@greyhouse.net>
>>> Signed-off-by: Veaceslav Falico <vfalico@gmail.com>
>>
>>Introduced in v3.14, so maybe steer this to 'net' instead?
> 
> Good idea. Should I re-send it or can you just apply it to net?

I'll just apply it, thanks.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/net/bonding/bond_sysfs_slave.c b/drivers/net/bonding/bond_sysfs_slave.c
index 198677f..5cd532c 100644
--- a/drivers/net/bonding/bond_sysfs_slave.c
+++ b/drivers/net/bonding/bond_sysfs_slave.c
@@ -125,7 +125,7 @@  int bond_sysfs_slave_add(struct slave *slave)
 	for (a = slave_attrs; *a; ++a) {
 		err = sysfs_create_file(&slave->kobj, &((*a)->attr));
 		if (err) {
-			kobject_del(&slave->kobj);
+			kobject_put(&slave->kobj);
 			return err;
 		}
 	}
@@ -140,5 +140,5 @@  void bond_sysfs_slave_del(struct slave *slave)
 	for (a = slave_attrs; *a; ++a)
 		sysfs_remove_file(&slave->kobj, &((*a)->attr));
 
-	kobject_del(&slave->kobj);
+	kobject_put(&slave->kobj);
 }