[openib-general] [PATCH 0/13] Re-write error cases in CMA routines to simplify code
Krishna Kumar2
krkumar2 at in.ibm.com
Thu Oct 12 21:46:38 PDT 2006
Hi Sean,
> Most of these seem to be a style issue. Should error handling be placed
at the
> end of the function, or within an if (error) type check? Keeping it at
the end
> of the function tends to make maintenance a little easier, otherwise, we
end up
> either duplicating the error handling, or moving it back to the end of
the function.
Correct. But many patches have just one "go to" case and the error
handling is
also one line. So an "if (unlikely(err))" (since unlikely is still in
favour with kernel
community, last I saw) could be used to handle these cases.
But if there is a case of multiple allocation or other failure to be
handled, then it
makes sense to put those cases at the bottom, like :
if (kmalloc() fails)
goto out1;
if (another kmalloc fails)
goto out2;
if (fn_fails)
goto out3;
out3:
out2:
out1:
etc...
I have avoided changing those codes in this patchset since I believe that
is the
correct way to do error handling.
Thanks,
- KK
More information about the general
mailing list