On Thu, Feb 04, 2021 at 06:33:51PM +0200, Vladimir Oltean wrote:
> Since teardown is supposed to undo the effects of the setup method, it
> should be called in the error path for dsa_switch_setup, not just in
> dsa_switch_teardown.

I disagree with this. If setup failed, it should of cleaned itself up.
That is the generally accepted way of doing things. If a function is
going to exit with an error, it should first undo whatever it did
before exiting.

You are adding extra semantics to the teardown op. It can no longer
assume setup was successful. So it needs to be very careful about what
it tears down, it cannot assume everything has been setup. I doubt the
existing implementations actually do that.

   Andrew

Reply via email to