Message ID | 20230201101559.15529-7-johan+linaro@kernel.org |
---|---|
State | Superseded |
Headers | show |
Series | interconnect: fix racy provider registration | expand |
On 1.02.2023 11:15, Johan Hovold wrote: > Make sure to clean up and release resources properly also in case probe > fails when populating child devices. > > Fixes: e39bf2972c6e ("interconnect: icc-rpm: Support child NoC device probe") > Cc: stable@vger.kernel.org # 5.17 > Signed-off-by: Johan Hovold <johan+linaro@kernel.org> > --- Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org> Konrad > drivers/interconnect/qcom/icc-rpm.c | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > > diff --git a/drivers/interconnect/qcom/icc-rpm.c b/drivers/interconnect/qcom/icc-rpm.c > index df3196f72536..91778cfcbc65 100644 > --- a/drivers/interconnect/qcom/icc-rpm.c > +++ b/drivers/interconnect/qcom/icc-rpm.c > @@ -541,8 +541,11 @@ int qnoc_probe(struct platform_device *pdev) > platform_set_drvdata(pdev, qp); > > /* Populate child NoC devices if any */ > - if (of_get_child_count(dev->of_node) > 0) > - return of_platform_populate(dev->of_node, NULL, NULL, dev); > + if (of_get_child_count(dev->of_node) > 0) { > + ret = of_platform_populate(dev->of_node, NULL, NULL, dev); > + if (ret) > + goto err; > + } > > return 0; > err:
diff --git a/drivers/interconnect/qcom/icc-rpm.c b/drivers/interconnect/qcom/icc-rpm.c index df3196f72536..91778cfcbc65 100644 --- a/drivers/interconnect/qcom/icc-rpm.c +++ b/drivers/interconnect/qcom/icc-rpm.c @@ -541,8 +541,11 @@ int qnoc_probe(struct platform_device *pdev) platform_set_drvdata(pdev, qp); /* Populate child NoC devices if any */ - if (of_get_child_count(dev->of_node) > 0) - return of_platform_populate(dev->of_node, NULL, NULL, dev); + if (of_get_child_count(dev->of_node) > 0) { + ret = of_platform_populate(dev->of_node, NULL, NULL, dev); + if (ret) + goto err; + } return 0; err:
Make sure to clean up and release resources properly also in case probe fails when populating child devices. Fixes: e39bf2972c6e ("interconnect: icc-rpm: Support child NoC device probe") Cc: stable@vger.kernel.org # 5.17 Signed-off-by: Johan Hovold <johan+linaro@kernel.org> --- drivers/interconnect/qcom/icc-rpm.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)