On Sat, Feb 03, 2007 at 11:56:16PM +0100, Richard Knutsson wrote:Not really, I agree on this :)
Ahmed S. Darwish wrote:
Hi all,So:
In CodingStyle Chapter 16 "Function return value and names", why not
adding a comment about the favorable community way of checking the return
value. ie:
ret = do_method();
if (ret) {
/* deal with error */
}
and not other ways like:
if (do_method()) or
if (is_true()) {
/* do something */
}
is alright then? If so, I agree, but please make it real clear in the document ;)
Good catch :). A small grep of `access_ok' reveals that it's always used in the form of:
if (!access_ok()) { .. }
I can conclude that verbal/imperative methods like `kmalloc, add_work' be checked as:
ret = do_work();
if (ret) { ... }
and predicate methods like `acess_ok, pci_dev_present' be checked like:
if (!access_ok) { ... }
if (pci_dev_present) { ...}
Any comments ?