linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kernel/params.c: print failure information instead of 'KOBJ_ADD' to user space, when sysfs_create_file() fails.
@ 2013-07-09  3:37 Chen Gang
  2013-07-09  8:07 ` Rusty Russell
  0 siblings, 1 reply; 10+ messages in thread
From: Chen Gang @ 2013-07-09  3:37 UTC (permalink / raw)
  To: Rusty Russell, khali, David.Woodhouse; +Cc: linux-kernel@vger.kernel.org

When sysfs_create_file() fails, recommend to print the related failure
information. And it is useless to still 'KOBJ_ADD' to user space.

Signed-off-by: Chen Gang <gang.chen@asianux.com>
---
 kernel/params.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/kernel/params.c b/kernel/params.c
index 440e65d..f5299c1 100644
--- a/kernel/params.c
+++ b/kernel/params.c
@@ -845,7 +845,13 @@ static void __init version_sysfs_builtin(void)
 		mk = locate_module_kobject(vattr->module_name);
 		if (mk) {
 			err = sysfs_create_file(&mk->kobj, &vattr->mattr.attr);
-			kobject_uevent(&mk->kobj, KOBJ_ADD);
+			if (err)
+				printk(KERN_WARNING
+				       "%s (%d): sysfs_create_file fail for %s, err: %d\n",
+				       __FILE__, __LINE__,
+				       vattr->module_name, err);
+			else
+				kobject_uevent(&mk->kobj, KOBJ_ADD);
 			kobject_put(&mk->kobj);
 		}
 	}
-- 
1.7.7.6

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2013-07-22  2:42 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-09  3:37 [PATCH] kernel/params.c: print failure information instead of 'KOBJ_ADD' to user space, when sysfs_create_file() fails Chen Gang
2013-07-09  8:07 ` Rusty Russell
2013-07-10  2:17   ` Chen Gang F T
2013-07-10  2:35     ` Chen Gang
2013-07-10  3:01       ` Chen Gang F T
2013-07-11 23:45         ` Chen Gang
2013-07-11  1:53     ` Rusty Russell
2013-07-11  2:57       ` Chen Gang
2013-07-11  4:06       ` [PATCH v2] kernel/params.c: add/modify failure processing code " Chen Gang
2013-07-22  2:41         ` Chen Gang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).