While wondering if it was correct to call mdiobus_free() in the remove function and only kfree() in the error handling of the probe, I arrived at the conclusion that the code could be simpler here. Patch 1 uses mdiobus_alloc_size() instead of a hand written mdiobus_alloc() + kzalloc(). it also uses the devm_ version in order to save some LoC (and answer my initial question) Patch 2 uses devm_of_mdiobus_register() to completly remove the .remove() function and save some more LoC. Both patches are compile tested only. Christophe JAILLET (2): powerpc: gpio_mdio: Use devm_mdiobus_alloc_size() powerpc: gpio_mdio: Use devm_of_mdiobus_register() arch/powerpc/platforms/pasemi/gpio_mdio.c | 41 ++++------------------- 1 file changed, 6 insertions(+), 35 deletions(-) -- 2.48.1