lkml.org 
[lkml]   [2018]   [Dec]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH v14 08/11] livepatch: Remove Nop structures when unused
    On Thu, Nov 29, 2018 at 10:44:28AM +0100, Petr Mladek wrote:
    > +static void __klp_free_funcs(struct klp_object *obj, bool free_all)
    > {
    > - struct klp_func *func;
    > + struct klp_func *func, *tmp_func;
    > +
    > + klp_for_each_func_safe(obj, func, tmp_func) {
    > + if (!free_all && !func->nop)
    > + continue;

    I suspect that changing 'free_all" to 'nops_only' (and inverting the
    condition) would make the code more readable.

    And a similar suggestion for __klp_free_objects().

    > +
    > + /*
    > + * Avoid double free. It would be tricky to wait for kobject
    > + * callbacks when only NOPs are handled.
    > + */
    > + list_del(&func->node);

    I've read this comment several times but I still have no idea how it
    relates to the code :-)

    And a similar comment for __klp_free_objects().

    --
    Josh

    \
     
     \ /
      Last update: 2018-12-14 00:00    [W:2.594 / U:2.124 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site