aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/bridge/br_if.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
index dadec949d4fe..298e0f463c56 100644
--- a/net/bridge/br_if.c
+++ b/net/bridge/br_if.c
@@ -258,12 +258,6 @@ static struct net_bridge_port *new_nbp(struct net_bridge *br,
258 p->state = BR_STATE_DISABLED; 258 p->state = BR_STATE_DISABLED;
259 br_stp_port_timer_init(p); 259 br_stp_port_timer_init(p);
260 260
261 kobject_init(&p->kobj);
262 kobject_set_name(&p->kobj, SYSFS_BRIDGE_PORT_ATTR);
263 p->kobj.ktype = &brport_ktype;
264 p->kobj.parent = &(dev->dev.kobj);
265 p->kobj.kset = NULL;
266
267 return p; 261 return p;
268} 262}
269 263
@@ -379,7 +373,8 @@ int br_add_if(struct net_bridge *br, struct net_device *dev)
379 if (IS_ERR(p)) 373 if (IS_ERR(p))
380 return PTR_ERR(p); 374 return PTR_ERR(p);
381 375
382 err = kobject_add(&p->kobj); 376 err = kobject_init_and_add(&p->kobj, &brport_ktype, &(dev->dev.kobj),
377 SYSFS_BRIDGE_PORT_ATTR);
383 if (err) 378 if (err)
384 goto err0; 379 goto err0;
385 380
@@ -416,6 +411,7 @@ err2:
416 br_fdb_delete_by_port(br, p, 1); 411 br_fdb_delete_by_port(br, p, 1);
417err1: 412err1:
418 kobject_del(&p->kobj); 413 kobject_del(&p->kobj);
414 return err;
419err0: 415err0:
420 kobject_put(&p->kobj); 416 kobject_put(&p->kobj);
421 return err; 417 return err;