diff --git a/lib/kobject.c b/lib/kobject.c index aa375a5d94419..207fd22ad3bde 100644 --- a/lib/kobject.c +++ b/lib/kobject.c @@ -850,6 +850,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)