Skip to content

Commit f659e8f

Browse files
zijun-hugregkh
authored andcommitted
driver core: class: Correct WARN() message in APIs class_(for_each|find)_device()
For both API class_for_each_device(const struct class *class, ...) and class_find_device(const struct class *class, ...), their WARN() messages prompt @Class was not initialized when suffer class_to_subsys(@Class) error, but the error actually means @Class was not registered, so these warning messages are not accurate. Fix by replacing term initialized with registered within these messages. Signed-off-by: Zijun Hu <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 2d038ef commit f659e8f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/base/class.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ int class_for_each_device(const struct class *class, const struct device *start,
405405
if (!class)
406406
return -EINVAL;
407407
if (!sp) {
408-
WARN(1, "%s called for class '%s' before it was initialized",
408+
WARN(1, "%s called for class '%s' before it was registered",
409409
__func__, class->name);
410410
return -EINVAL;
411411
}
@@ -453,7 +453,7 @@ struct device *class_find_device(const struct class *class, const struct device
453453
if (!class)
454454
return NULL;
455455
if (!sp) {
456-
WARN(1, "%s called for class '%s' before it was initialized",
456+
WARN(1, "%s called for class '%s' before it was registered",
457457
__func__, class->name);
458458
return NULL;
459459
}

0 commit comments

Comments
 (0)