]> www.infradead.org Git - users/willy/xarray.git/commit
net: dsa: ocelot: use devres in seville_probe()
authorVladimir Oltean <vladimir.oltean@nxp.com>
Thu, 30 May 2024 16:33:27 +0000 (19:33 +0300)
committerDavid S. Miller <davem@davemloft.net>
Mon, 3 Jun 2024 12:06:15 +0000 (13:06 +0100)
commit90ee9a5b49cea302b666217068e52e0bb325304d
treebbb31d6e7bf4abe3f85ed190da942d2589416caf
parent454cfffe8dc112f1ed3966923f5dccdafa3bebf2
net: dsa: ocelot: use devres in seville_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 seville_vsc9953 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>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/dsa/ocelot/seville_vsc9953.c