net: dsa: ocelot: use devres in ocelot_ext_probe()
authorVladimir Oltean <vladimir.oltean@nxp.com>
Thu, 30 May 2024 16:33:26 +0000 (19:33 +0300)
committerDavid S. Miller <davem@davemloft.net>
Mon, 3 Jun 2024 12:06:15 +0000 (13:06 +0100)
commit454cfffe8dc112f1ed3966923f5dccdafa3bebf2
treef6512a69514236f1af25848262b5a2f114d5444f
parent93e30878f7ecd775cb6e1e5aeed30d947a6cebad
net: dsa: ocelot: use devres in ocelot_ext_probe()

Russell King suggested that felix_vsc9959, seville_vsc9953 and
ocelot_ext have a large portion of duplicated init and teardown code,
which could be made common [1]. The teardown code could even be
simplified away if we made use of devres, something which is used here
and there in the felix driver, just not very consistently.

[1] https://lore.kernel.org/all/Zh1GvcOTXqb7CpQt@shell.armlinux.org.uk/

Prepare the ground in the ocelot_ext driver, by allocating the data
structures using devres and deleting the kfree() calls. This also
deletes the "Failed to allocate ..." message, since memory allocation
errors are extremely loud anyway, and it's hard to miss them.

Suggested-by: "Russell King (Oracle)" <linux@armlinux.org.uk>
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Colin Foster <colin.foster@in-advantage.com>
Tested-by: Colin Foster <colin.foster@in-advantage.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/dsa/ocelot/ocelot_ext.c