[openib-general] [PATCH]small cleanup in cache.c

Roland Dreier rolandd at cisco.com
Wed Oct 5 09:04:54 PDT 2005


    > -       kfree(old_pkey_cache);
    > -       kfree(old_gid_cache);
    > +       if (old_pkey_cache)
    > +               kfree(old_pkey_cache);
    > +       if (old_gid_cache)
    > +               kfree(old_gid_cache);

This isn't needed and in fact having this check is considered bad
kernel style.  The first thing kfree() does is check if the pointer is
NULL, so duplicating this check in the caller just makes the code bigger.

 - R.



More information about the general mailing list