diff --git a/lib/kobject.c b/lib/kobject.c index 16d530f9c174b..4c7a990d6f120 100644 --- a/lib/kobject.c +++ b/lib/kobject.c @@ -854,6 +854,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) {