Skip to content

Commit 037116a

Browse files
zijun-hugregkh
authored andcommitted
driver core: Correct parameter check for API device_for_each_child_reverse_from()
device_for_each_child_reverse_from() checks (!parent->p) for its parameter @parent, and that is not consistent with other APIs of its cluster as shown below: device_for_each_child_reverse_from() // check (!parent->p) device_for_each_child_reverse() // check (!parent || !parent->p) device_for_each_child() // same above device_find_child() // same above Correct the API's parameter @parent check by (!parent || !parent->p). Reviewed-by: Jonathan Cameron <[email protected]> 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 ab017a1 commit 037116a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/base/core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4050,7 +4050,7 @@ int device_for_each_child_reverse_from(struct device *parent,
40504050
struct device *child;
40514051
int error = 0;
40524052

4053-
if (!parent->p)
4053+
if (!parent || !parent->p)
40544054
return 0;
40554055

40564056
klist_iter_init_node(&parent->p->klist_children, &i,

0 commit comments

Comments
 (0)