Skip to content

Commit

Permalink
kobject: don't use WARN for registration failures
Browse files Browse the repository at this point in the history
This WARNING proved to be noisy. The function still returns an error
and callers should handle it. That's how most of kernel code works.
Downgrade the WARNING to pr_err() and leave WARNINGs for kernel bugs.

Signed-off-by: Dmitry Vyukov <[email protected]>
Reported-by: [email protected]
Reported-by: [email protected]
Reported-by: [email protected]
Reported-by: [email protected]
Cc: stable <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
dvyukov authored and gregkh committed Apr 23, 2018
1 parent df9267f commit 3e14c6a
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions lib/kobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -233,13 +233,12 @@ static int kobject_add_internal(struct kobject *kobj)

/* be noisy on error issues */
if (error == -EEXIST)
WARN(1,
"%s failed for %s with -EEXIST, don't try to register things with the same name in the same directory.\n",
__func__, kobject_name(kobj));
pr_err("%s failed for %s with -EEXIST, don't try to register things with the same name in the same directory.\n",
__func__, kobject_name(kobj));
else
WARN(1, "%s failed for %s (error: %d parent: %s)\n",
__func__, kobject_name(kobj), error,
parent ? kobject_name(parent) : "'none'");
pr_err("%s failed for %s (error: %d parent: %s)\n",
__func__, kobject_name(kobj), error,
parent ? kobject_name(parent) : "'none'");
} else
kobj->state_in_sysfs = 1;

Expand Down

0 comments on commit 3e14c6a

Please sign in to comment.