Re: [net 1/8] igb: Update queue reinit function to call dev_close when init of queues fails
From: David Miller <davem@davemloft.net>
Date: 2013-12-02 18:33:52
From: David Miller <davem@davemloft.net>
Date: 2013-12-02 18:33:52
From: Ben Hutchings <redacted> Date: Mon, 2 Dec 2013 17:18:16 +0000
David is saying that you should implement the reconfiguration in such a way that you can always roll back to the previous working state in case of a failure (which would make my concerns moot). This is definitely a good goal but I'm not convinced that it's always possible.
In this case it is always possible. The only failure possible in these code paths is for a memory allocation failure. Therefore, without a doubt, trying to allocate the memory first before making any changes will provably allow perfect rollback to a working state. In fact, no state will be changed at all if the allocation fails. That's the whole point of my suggestion. Do the one thing that can fail, the memory allocation, before adjusting anything else.