Thanks for catching this. There are two things wrong: register_disk() is
calling kobject_register() instead of kobject_add(). This is fixed with a
patch I posted earlier today.
Also, though it is now irrelevant in this case, kobject_register() was
causing the object to be freed if kobject_add() failed. This is a bit
rude, though kobject_add() really shoudln't fail. It can fail because of
these reasons:
- sysfs isn't mounted yet.
- we couldn't get an inode.
- the file or directory already existed.
In each case, we probably want to know about it. So, the patch below
changes the call to kobject_cleanup() to a WARN_ON(error) to flag it, but
continue going..
Thanks,
-pat
===== lib/kobject.c 1.8 vs edited =====
--- 1.8/lib/kobject.c Thu Nov 21 17:01:53 2002
+++ edited/lib/kobject.c Mon Nov 25 16:01:53 2002
@@ -110,8 +110,7 @@
if (kobj) {
kobject_init(kobj);
error = kobject_add(kobj);
- if (error)
- kobject_cleanup(kobj);
+ WARN_ON(error);
} else
error = -EINVAL;
return error;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/