• Sebastian Siewior's avatar
    net/sb1250: register mdio bus in probe · 03f80cc3
    Sebastian Siewior authored
    "ifconfig eth0 up && ifconfig eth0 down" triggers:
    | kobject (a8000000cfa5a480): tried to init an initialized object, something is seriously wrong.
    | Call Trace:
    | [<ffffffff8010aabc>] dump_stack+0x8/0x34
    | [<ffffffff80293128>] kobject_init+0xe8/0xf0
    | [<ffffffff802d922c>] device_initialize+0x2c/0x98
    | [<ffffffff802d9cfc>] device_register+0x14/0x28
    | [<ffffffff80312cd4>] mdiobus_register+0xdc/0x1e0
    | [<ffffffff80314cf0>] sbmac_open+0x58/0x220
    | [<ffffffff803519bc>] __dev_open+0x11c/0x180
    | [<ffffffff8034d578>] __dev_change_flags+0x120/0x180
    | [<ffffffff80351848>] dev_change_flags+0x20/0x78
    | [<ffffffff803a753c>] devinet_ioctl+0x7cc/0x820
    | [<ffffffff80339ac8>] sock_do_ioctl+0x38/0x90
    | [<ffffffff8033a258>] compat_sock_ioctl_trans+0x408/0x1030
    | [<ffffffff8033af30>] compat_sock_ioctl+0xb0/0xd0
    | [<ffffffff80208b08>] compat_sys_ioctl+0xa0/0x18b8
    | [<ffffffff80102f94>] handle_sys+0x114/0x130
    |
    | sb1250-mac-mdio: probed
    
    mdiobus_register() calls device_register() which initializes the kobj of
    the device. mdiobus_unregister() calls only device_del() so we have one
    reference left. That one is leaving with mdiobus_free() which is only
    called on remove.
    Since I don't see any reason why mdiobus_register()/mdiobus_unregister()
    should happen in ->open()/->close() I move them to probe & exit.
    Signed-off-by: default avatarSebastian Andrzej Siewior <sebastian@breakpoint.cc>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    03f80cc3
sb1250-mac.c 71 KB