> 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