Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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 <Jonathan.Cameron@huawei.com>
Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
Link: https://lore.kernel.org/r/20250105-class_fix-v6-5-3a2f1768d4d4@quicinc.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Zijun Hu and committed by
Greg Kroah-Hartman
037116a6 ab017a15

+1 -1
+1 -1
drivers/base/core.c
··· 4050 4050 struct device *child; 4051 4051 int error = 0; 4052 4052 4053 - if (!parent->p) 4053 + if (!parent || !parent->p) 4054 4054 return 0; 4055 4055 4056 4056 klist_iter_init_node(&parent->p->klist_children, &i,