Re: [PATCH] net: mv643xx_eth: handle EPROBE_DEFER

From: Andrew Lunn
Date: Mon Feb 21 2022 - 17:15:09 EST


> > 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().

Andrew