diff options
| author | Ingo Molnar <mingo@elte.hu> | 2008-09-05 12:56:57 -0400 |
|---|---|---|
| committer | Ingo Molnar <mingo@elte.hu> | 2008-09-05 12:56:57 -0400 |
| commit | 616ad8c44281c0c6711a72b560e01ec335ff27e0 (patch) | |
| tree | 0a20453ffedb09db6fb41a0c2208ccc2c7751d3a /drivers/base/class.c | |
| parent | 99809963c99e1ed868d9ebeb4a5e7ee1cbe0309f (diff) | |
| parent | b380b0d4f7dffcc235c0facefa537d4655619101 (diff) | |
Merge branch 'linus' into x86/defconfig
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) { |
