Commit 037116a6 authored by Zijun Hu's avatar Zijun Hu Committed by Greg Kroah-Hartman
Browse files

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: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: default avatarZijun Hu <quic_zijuhu@quicinc.com>
Link: https://lore.kernel.org/r/20250105-class_fix-v6-5-3a2f1768d4d4@quicinc.com


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent ab017a15
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -4050,7 +4050,7 @@ int device_for_each_child_reverse_from(struct device *parent,
	struct device *child;
	int error = 0;

	if (!parent->p)
	if (!parent || !parent->p)
		return 0;

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