Re: [PATCH] net: mv643xx_eth: handle EPROBE_DEFER

From: Mauri Sandberg
Date: Tue Feb 22 2022 - 00:42:58 EST



On 22.2.2022 0.15, Andrew Lunn wrote:
Please can you add code to remove the platform device when the probe
fails.

I am looking at the vector 'port_platdev' that holds pointers to already
initialised ports. There is this mv643xx_eth_shared_of_remove(), which
probably could be utilised to remove them. Should I remove the platform
devices only in case of probe defer or always if probe fails?
In general, a failing probe should always undo anything it has done so
far. Sometimes you can call the release function, or its
helpers. Other times you do a goto out: and then release stuff in the
reverse order it was taken.

It looks like platform_device_del() can take a NULL pointer, so it is
probably O.K. to call mv643xx_eth_shared_of_remove().

While I am on it, should I call of_node_put() to all port nodes as is
being done to the current child node if probe fails in function
mv643xx_eth_shared_of_probe() [1]?

[1] https://elixir.bootlin.com/linux/v5.16/source/drivers/net/ethernet/marvell/mv643xx_eth.c#L2800

-- Mauri