Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1573633
| From | Mark Brown <broonie@kernel.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: regulator_get_optional() no longer returning NULL? |
| Date | 2017-02-04 11:10 +0100 |
| Message-ID | <t75s5-7oX-15@gated-at.bofh.it> (permalink) |
| References | <t6bzz-3Hx-3@gated-at.bofh.it> <t6KdY-Xs-23@gated-at.bofh.it> <t6U3E-7uQ-41@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
[Multipart message — attachments visible in raw view] - view raw
On Fri, Feb 03, 2017 at 01:51:20PM -0800, Dmitry Torokhov wrote: > Like I said, I want people to simply check for error/!error and have all > errors be fatal, and the rest of the checks (when trying to use said > regulator) should be in form of: > if (blah->supply) > regulator_enable(supply). I am very dubious about this sort of pattern, it's fairly rare to get optional supplies at all and when they're there they tend to be more clearly described at a higher level than just checking for the regulator. > Or even teach regulator_enable() to like NULLs. We definitely should not do this, we already have far too many problems with people not writing appropriate error handling code and this just encourages the "we got an error, set the regulator to NULL" behaviour that seems to go along with this. For most of the reasonable use cases we need explicit handling for the case where the regulator isn't there so it's not particularly optimising anything.
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
regulator_get_optional() no longer returning NULL? Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2017-02-01 23:30 +0100
Re: regulator_get_optional() no longer returning NULL? Mark Brown <broonie@kernel.org> - 2017-02-03 12:30 +0100
Re: regulator_get_optional() no longer returning NULL? Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2017-02-03 23:00 +0100
Re: regulator_get_optional() no longer returning NULL? Mark Brown <broonie@kernel.org> - 2017-02-04 11:10 +0100
csiph-web