Skip to content

Commit

Permalink
bonding: use kobject_put instead of _del after kobject_add
Browse files Browse the repository at this point in the history
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
vfalico authored and davem330 committed Jul 31, 2014
1 parent c36c9d5 commit 7afcaec
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/net/bonding/bond_sysfs_slave.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand All @@ -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);
}

0 comments on commit 7afcaec

Please sign in to comment.