lkml.org 
[lkml]   [2018]   [Dec]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v14 03/11] livepatch: Consolidate klp_free functions
On Thu, Nov 29, 2018 at 10:44:23AM +0100, Petr Mladek wrote:
> +static void klp_free_funcs(struct klp_object *obj)
> {
> struct klp_func *func;
>
> - for (func = obj->funcs; func->old_name && func != limit; func++)
> - kobject_put(&func->kobj);
> + klp_for_each_func(obj, func) {
> + /* Might be called from klp_init_patch() error path. */
> + if (func->kobj_alive) {
> + func->kobj_alive = false;
> + kobject_put(&func->kobj);
> + }

Why does it set 'kobj_alive' to false? The value will never be read
again anyway, right?

Also, the name isn't quite right. The kobject is technically still
alive here, and may even continue to be alive after the kobject_put(),
if there's a sysfs reference to it somewhere.

Maybe it should be called something like 'kobj_initialized' instead.
Then it doesn't ever need to be set to false -- unless I'm missing
something.

(And the same comment for the other 'kobj_alive' fields in
klp_object/patch.)

--
Josh

\
 
 \ /
  Last update: 2018-12-13 23:11    [W:0.156 / U:1.232 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site