[openib-general] [PATCH 4/13] Re-write cma_work_handler error cases
Krishna Kumar2
krkumar2 at in.ibm.com
Thu Oct 12 21:40:39 PDT 2006
> There's lot of code doing :
To give examples on the above statement, the patches :
#2, #8, #10, #12 (all are one line, and one "go to" case patches)
#6, #9, #11, #13 (these are 2 line error handling, not 1 line)
#3 cleans up error handling to remove multiple goto err's.
#7 is an optimization in case dev_list is empty.
Thanks,
- KK
Krishna Kumar2/India/IBM wrote on 10/13/2006 10:00:17 AM:
> Roland Dreier <rdreier at cisco.com> wrote on 10/13/2006 12:08:25 AM:
>
> > What's the motivation here?
>
> There's lot of code doing :
>
> ret = fn()
> if (ret)
> goto err;
> return 0;
> err:
> one_line_cleanup;
> return ret;
>
> which could be easily made easier to code/understand as :
> ret = fn()
> if (ret)
> one_line_cleanup;
> return ret;
>
> I guess we could even change that to unlikely(err) to prevent error
> paths from getting loaded into the instruction pipeline. Also, almost
> 30 lines of code were removed (though I didn't check the obj size
> change which may not be much).
>
> > I find it much easier to read code like:
> For this particular case you pointed out, that is true. But a lot of
other
> places do the code that I showed above - where there are no multiple
> goto's to error paths, and hence would make sense to do this. That is
> also the reason I split the patch into multiple patches so that ones
that
> are accepted could be merged rather than one big patch which
> incorporates everything.
>
> Thanks,
>
> - KK
More information about the general
mailing list