diff options
| author | H. Peter Anvin <hpa@zytor.com> | 2008-08-26 01:45:37 -0400 |
|---|---|---|
| committer | H. Peter Anvin <hpa@zytor.com> | 2008-08-26 01:45:37 -0400 |
| commit | 94d4ac2f4a58c6e37876827c6688c61cef21290c (patch) | |
| tree | 732f4e4794f3c116041242f69754637f75c0dd57 /drivers/base/class.c | |
| parent | ed21763e7b0b3fb50e4efd9d4bc17ef5b035d304 (diff) | |
| parent | 08970fc4e0385790a7b093adfaa4165a189f9eb0 (diff) | |
Merge branch 'x86/urgent' into x86/cleanups
Diffstat (limited to 'drivers/base/class.c')
| -rw-r--r-- | drivers/base/class.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/base/class.c b/drivers/base/class.c index 5667c2f02c51..cc5e28c8885c 100644 --- a/drivers/base/class.c +++ b/drivers/base/class.c | |||
| @@ -295,6 +295,12 @@ int class_for_each_device(struct class *class, struct device *start, | |||
| 295 | 295 | ||
| 296 | if (!class) | 296 | if (!class) |
| 297 | return -EINVAL; | 297 | return -EINVAL; |
| 298 | if (!class->p) { | ||
| 299 | WARN(1, "%s called for class '%s' before it was initialized", | ||
| 300 | __func__, class->name); | ||
| 301 | return -EINVAL; | ||
| 302 | } | ||
| 303 | |||
| 298 | mutex_lock(&class->p->class_mutex); | 304 | mutex_lock(&class->p->class_mutex); |
| 299 | list_for_each_entry(dev, &class->p->class_devices, node) { | 305 | list_for_each_entry(dev, &class->p->class_devices, node) { |
| 300 | if (start) { | 306 | if (start) { |
| @@ -344,6 +350,11 @@ struct device *class_find_device(struct class *class, struct device *start, | |||
| 344 | 350 | ||
| 345 | if (!class) | 351 | if (!class) |
| 346 | return NULL; | 352 | return NULL; |
| 353 | if (!class->p) { | ||
| 354 | WARN(1, "%s called for class '%s' before it was initialized", | ||
| 355 | __func__, class->name); | ||
| 356 | return NULL; | ||
| 357 | } | ||
| 347 | 358 | ||
| 348 | mutex_lock(&class->p->class_mutex); | 359 | mutex_lock(&class->p->class_mutex); |
| 349 | list_for_each_entry(dev, &class->p->class_devices, node) { | 360 | list_for_each_entry(dev, &class->p->class_devices, node) { |
