[openib-general] [PATCH 4/13] Re-write cma_work_handler error cases

Krishna Kumar2 krkumar2 at in.ibm.com
Thu Oct 12 21:30:17 PDT 2006


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