[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180226172522.GH3775@lunn.ch>
Date: Mon, 26 Feb 2018 18:25:22 +0100
From: Andrew Lunn <andrew@...n.ch>
To: Bryan.Whitehead@...rochip.com
Cc: f.fainelli@...il.com, davem@...emloft.net,
UNGLinuxDriver@...rochip.com, netdev@...r.kernel.org
Subject: Re: [PATCH v2 net-next 1/2] lan743x: Add main source files for new
lan743x driver
> But the other case is when things fail anywhere during probe, or
> open. In these cases things are partially initialized and I assumed
> I needed to clean up whatever was initialized successfully before
> returning an error. I used flags so I could share a common clean up
> function for all possible error cases as well as the fully
> successful case. Without flags I would need to customize a clean-up
> sequence for each possible error point.
Hi Bryan
It is good to look at other drivers and see how they work. Ideally,
your driver wants to look similar to all other drivers, so making the
maintenance easier.
You will find that most drivers have a set of goto statements for
error handling, which jump to the end of the function, and do cleanup.
No flags are maintained.
Andrew
Powered by blists - more mailing lists