diff --git a/lib/kobject.c b/lib/kobject.c index 0c6d17503a11..c4025a880d75 100644 --- a/lib/kobject.c +++ b/lib/kobject.c @@ -877,6 +877,11 @@ int kset_register(struct kset *k) if (!k) return -EINVAL; + if (!k->kobj.ktype) { + pr_err("must have a ktype to be initialized properly!\n"); + return -EINVAL; + } + kset_init(k); err = kobject_add_internal(&k->kobj); if (err)