Skip to content

Commit

Permalink
[PATCH] kernel/params: driver layer error checking
Browse files Browse the repository at this point in the history
Check driver layer return values in kernel/params.c

Signed-off-by: Randy Dunlap <rdunlap@xenotime.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
rddunlap authored and Linus Torvalds committed Sep 29, 2006
1 parent 5906e41 commit d8c7649
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions kernel/params.c
Original file line number Diff line number Diff line change
Expand Up @@ -547,14 +547,16 @@ static void __init kernel_param_sysfs_setup(const char *name,
unsigned int name_skip)
{
struct module_kobject *mk;
int ret;

mk = kzalloc(sizeof(struct module_kobject), GFP_KERNEL);
BUG_ON(!mk);

mk->mod = THIS_MODULE;
kobj_set_kset_s(mk, module_subsys);
kobject_set_name(&mk->kobj, name);
kobject_register(&mk->kobj);
ret = kobject_register(&mk->kobj);
BUG_ON(ret < 0);

/* no need to keep the kobject if no parameter is exported */
if (!param_sysfs_setup(mk, kparam, num_params, name_skip)) {
Expand Down Expand Up @@ -684,7 +686,14 @@ decl_subsys(module, &module_ktype, NULL);
*/
static int __init param_sysfs_init(void)
{
subsystem_register(&module_subsys);
int ret;

ret = subsystem_register(&module_subsys);
if (ret < 0) {
printk(KERN_WARNING "%s (%d): subsystem_register error: %d\n",
__FILE__, __LINE__, ret);
return ret;
}

param_sysfs_builtin();

Expand Down

0 comments on commit d8c7649

Please sign in to comment.