Messages in this thread | | | Date | Mon, 20 Feb 2012 12:57:57 -0800 | From | Mark Brown <> | Subject | Re: [PATCH] regulator: Fix and simplify debugfs support |
| |
On Sun, Feb 19, 2012 at 11:46:40PM -0800, Stephen Boyd wrote: > On 2/19/2012 6:12 PM, Mark Brown wrote:
> >This was actually a deliberate decision to make the code more robust > >against change - the IS_ERR_OR_NULL doesn't make the code any bigger but > >it means it's less likely to break in the face of changes.
> More robust? The debugfs code in the regulator core looks confused > on what the return value is. Sometimes it's IS_ERR, sometimes it's > NULL, sometimes it's both. Might as well clean it up to be > consistent and proper.
Well, the intention when I originally wrote it was to always check for all possible error codes. Looking at the code in mainline it's pretty consistent, the class wide check and the per rdev checks are both open coded IS_ERR_OR_NULL() and the per supply stuff uses the helper. The only case where we do a plain IS_ERR() is when we warn about not being able to create supply_map and the consistent thing there would just be to ignore the error since it's what we do for all the other individual files.
This thing with returning NULL instead of an actual ERR_PTR() is pretty unhelpful really, especially for something like debugfs where the caller shouldn't care much if it works or not. [unhandled content-type:application/pgp-signature] | |