Commit ad5429c7 authored by Patrick Mochel's avatar Patrick Mochel

kobject: fix oops in to_kset()

Check whether kset is NULL or not before doing container_of().

From Dominik Brodowski
parent 75afd0da
...@@ -73,7 +73,7 @@ extern void kset_unregister(struct kset * k); ...@@ -73,7 +73,7 @@ extern void kset_unregister(struct kset * k);
static inline struct kset * to_kset(struct kobject * kobj) static inline struct kset * to_kset(struct kobject * kobj)
{ {
return container_of(kobj,struct kset,kobj); return kobj ? container_of(kobj,struct kset,kobj) : NULL;
} }
static inline struct kset * kset_get(struct kset * k) static inline struct kset * kset_get(struct kset * k)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment