mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 02:32:09 -04:00
cxl: replace loop with for_each_child_of_node(), remove unneeded of_node_put()
Rewrite the cxl_guest_init_afu() loop in cxl_of_probe() to use for_each_child_of_node() rather than a hand-coded for loop. Remove the useless of_node_put(afu_np) call after the loop, where it's guaranteed that afu_np == NULL. Reported-by: SF Markus Elfring <[email protected]> Reported-by: Julia Lawall <[email protected]> Signed-off-by: Andrew Donnellan <[email protected]> Reviewed-by: Frederic Barrat <[email protected]> Signed-off-by: Michael Ellerman <[email protected]>
This commit is contained in:
parent
aaa2245ed8
commit
735840b44b
1 changed files with 3 additions and 5 deletions
|
|
@ -460,7 +460,7 @@ int cxl_of_probe(struct platform_device *pdev)
|
|||
struct device_node *afu_np = NULL;
|
||||
struct cxl *adapter = NULL;
|
||||
int ret;
|
||||
int slice, slice_ok;
|
||||
int slice = 0, slice_ok = 0;
|
||||
|
||||
pr_devel("in %s\n", __func__);
|
||||
|
||||
|
|
@ -476,13 +476,13 @@ int cxl_of_probe(struct platform_device *pdev)
|
|||
}
|
||||
|
||||
/* init afu */
|
||||
slice_ok = 0;
|
||||
for (afu_np = NULL, slice = 0; (afu_np = of_get_next_child(np, afu_np)); slice++) {
|
||||
for_each_child_of_node(np, afu_np) {
|
||||
if ((ret = cxl_guest_init_afu(adapter, slice, afu_np)))
|
||||
dev_err(&pdev->dev, "AFU %i failed to initialise: %i\n",
|
||||
slice, ret);
|
||||
else
|
||||
slice_ok++;
|
||||
slice++;
|
||||
}
|
||||
|
||||
if (slice_ok == 0) {
|
||||
|
|
@ -490,8 +490,6 @@ int cxl_of_probe(struct platform_device *pdev)
|
|||
adapter->slices = 0;
|
||||
}
|
||||
|
||||
if (afu_np)
|
||||
of_node_put(afu_np);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue