* [PATCH] interconnect: qcom: icc-rpmh: Fix an error handling path in qcom_icc_rpmh_probe()
@ 2022-11-20 12:35 Christophe JAILLET
2022-11-21 7:42 ` Luca Weiss
0 siblings, 1 reply; 5+ messages in thread
From: Christophe JAILLET @ 2022-11-20 12:35 UTC (permalink / raw)
To: Andy Gross, Bjorn Andersson, Konrad Dybcio, Georgi Djakov, Luca Weiss
Cc: linux-kernel, kernel-janitors, Christophe JAILLET, linux-arm-msm,
linux-pm
If of_platform_populate() fails, some resources need to be freed as already
done in the other error handling paths.
Fixes: 57eb14779dfd ("interconnect: qcom: icc-rpmh: Support child NoC device probe")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
drivers/interconnect/qcom/icc-rpmh.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/interconnect/qcom/icc-rpmh.c b/drivers/interconnect/qcom/icc-rpmh.c
index fd17291c61eb..5168bbf3d92f 100644
--- a/drivers/interconnect/qcom/icc-rpmh.c
+++ b/drivers/interconnect/qcom/icc-rpmh.c
@@ -235,8 +235,11 @@ int qcom_icc_rpmh_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:
--
2.34.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] interconnect: qcom: icc-rpmh: Fix an error handling path in qcom_icc_rpmh_probe()
2022-11-20 12:35 [PATCH] interconnect: qcom: icc-rpmh: Fix an error handling path in qcom_icc_rpmh_probe() Christophe JAILLET
@ 2022-11-21 7:42 ` Luca Weiss
2022-11-21 21:08 ` Christophe JAILLET
2022-11-22 21:45 ` Christophe JAILLET
0 siblings, 2 replies; 5+ messages in thread
From: Luca Weiss @ 2022-11-21 7:42 UTC (permalink / raw)
To: Christophe JAILLET, Andy Gross, Bjorn Andersson, Konrad Dybcio,
Georgi Djakov
Cc: linux-kernel, kernel-janitors, linux-arm-msm, linux-pm
Hi Christophe,
On Sun Nov 20, 2022 at 1:35 PM CET, Christophe JAILLET wrote:
> If of_platform_populate() fails, some resources need to be freed as already
> done in the other error handling paths.
>
> Fixes: 57eb14779dfd ("interconnect: qcom: icc-rpmh: Support child NoC device probe")
I believe the same needs to be applied to icc-rpm.c.
Also there shouldn't be an empty line here between Fixes: and Signed-off-by:
Regards
Luca
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> drivers/interconnect/qcom/icc-rpmh.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/interconnect/qcom/icc-rpmh.c b/drivers/interconnect/qcom/icc-rpmh.c
> index fd17291c61eb..5168bbf3d92f 100644
> --- a/drivers/interconnect/qcom/icc-rpmh.c
> +++ b/drivers/interconnect/qcom/icc-rpmh.c
> @@ -235,8 +235,11 @@ int qcom_icc_rpmh_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:
> --
> 2.34.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] interconnect: qcom: icc-rpmh: Fix an error handling path in qcom_icc_rpmh_probe()
2022-11-21 7:42 ` Luca Weiss
@ 2022-11-21 21:08 ` Christophe JAILLET
2022-11-22 21:45 ` Christophe JAILLET
1 sibling, 0 replies; 5+ messages in thread
From: Christophe JAILLET @ 2022-11-21 21:08 UTC (permalink / raw)
To: Luca Weiss, Andy Gross, Bjorn Andersson, Konrad Dybcio, Georgi Djakov
Cc: linux-kernel, kernel-janitors, linux-arm-msm, linux-pm
Le 21/11/2022 à 08:42, Luca Weiss a écrit :
> Hi Christophe,
>
> On Sun Nov 20, 2022 at 1:35 PM CET, Christophe JAILLET wrote:
>> If of_platform_populate() fails, some resources need to be freed as already
>> done in the other error handling paths.
>>
>> Fixes: 57eb14779dfd ("interconnect: qcom: icc-rpmh: Support child NoC device probe")
>
> I believe the same needs to be applied to icc-rpm.c.
I'll give it a look and send a v2.
CJ
>
> Also there shouldn't be an empty line here between Fixes: and Signed-off-by:
>
> Regards
> Luca
>
>>
>> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
>> ---
>> drivers/interconnect/qcom/icc-rpmh.c | 7 +++++--
>> 1 file changed, 5 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/interconnect/qcom/icc-rpmh.c b/drivers/interconnect/qcom/icc-rpmh.c
>> index fd17291c61eb..5168bbf3d92f 100644
>> --- a/drivers/interconnect/qcom/icc-rpmh.c
>> +++ b/drivers/interconnect/qcom/icc-rpmh.c
>> @@ -235,8 +235,11 @@ int qcom_icc_rpmh_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:
>> --
>> 2.34.1
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] interconnect: qcom: icc-rpmh: Fix an error handling path in qcom_icc_rpmh_probe()
2022-11-21 7:42 ` Luca Weiss
2022-11-21 21:08 ` Christophe JAILLET
@ 2022-11-22 21:45 ` Christophe JAILLET
2022-11-23 7:32 ` Luca Weiss
1 sibling, 1 reply; 5+ messages in thread
From: Christophe JAILLET @ 2022-11-22 21:45 UTC (permalink / raw)
To: Luca Weiss, Andy Gross, Bjorn Andersson, Konrad Dybcio, Georgi Djakov
Cc: linux-kernel, kernel-janitors, linux-arm-msm, linux-pm
Le 21/11/2022 à 08:42, Luca Weiss a écrit :
> Hi Christophe,
>
> On Sun Nov 20, 2022 at 1:35 PM CET, Christophe JAILLET wrote:
>> If of_platform_populate() fails, some resources need to be freed as already
>> done in the other error handling paths.
>>
>> Fixes: 57eb14779dfd ("interconnect: qcom: icc-rpmh: Support child NoC device probe")
>
> I believe the same needs to be applied to icc-rpm.c.
Their are other issues in the error handling path of this file.
1) if (desc->has_bus_pd) {
ret = dev_pm_domain_attach(dev, true);
is unbalanced, both in the error handling path and in the remove function.
2) clk_bulk_prepare_enable()
is not balanced in all error handling paths.
3) the same issue about error handling if of_platform_populate() fails.
These issues have been introduced in different commits.
Would you prefer several patches, each related to a given Fixes: tag, or
one bigger "fix all error handling paths"?
Anyway, fixing the points above would require moving some code around.
Usually I try to avoid it, because it is not always easy to see
associated side effects.
CJ
>
> Also there shouldn't be an empty line here between Fixes: and Signed-off-by:
>
> Regards
> Luca
>
>>
>> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
>> ---
>> drivers/interconnect/qcom/icc-rpmh.c | 7 +++++--
>> 1 file changed, 5 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/interconnect/qcom/icc-rpmh.c b/drivers/interconnect/qcom/icc-rpmh.c
>> index fd17291c61eb..5168bbf3d92f 100644
>> --- a/drivers/interconnect/qcom/icc-rpmh.c
>> +++ b/drivers/interconnect/qcom/icc-rpmh.c
>> @@ -235,8 +235,11 @@ int qcom_icc_rpmh_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:
>> --
>> 2.34.1
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] interconnect: qcom: icc-rpmh: Fix an error handling path in qcom_icc_rpmh_probe()
2022-11-22 21:45 ` Christophe JAILLET
@ 2022-11-23 7:32 ` Luca Weiss
0 siblings, 0 replies; 5+ messages in thread
From: Luca Weiss @ 2022-11-23 7:32 UTC (permalink / raw)
To: Christophe JAILLET, Andy Gross, Bjorn Andersson, Konrad Dybcio,
Georgi Djakov
Cc: linux-kernel, kernel-janitors, linux-arm-msm, linux-pm
Hi Christophe,
On Tue Nov 22, 2022 at 10:45 PM CET, Christophe JAILLET wrote:
> > I believe the same needs to be applied to icc-rpm.c.
>
> Their are other issues in the error handling path of this file.
>
> 1) if (desc->has_bus_pd) {
> ret = dev_pm_domain_attach(dev, true);
> is unbalanced, both in the error handling path and in the remove function.
>
>
> 2) clk_bulk_prepare_enable()
> is not balanced in all error handling paths.
>
>
> 3) the same issue about error handling if of_platform_populate() fails.
>
>
> These issues have been introduced in different commits.
>
>
> Would you prefer several patches, each related to a given Fixes: tag, or
> one bigger "fix all error handling paths"?
I don't really have an opinion on this, I guess if the issues were
introduced in different commits, make separate fixes?
If it's the wrong way somebody will tell you anyways ;)
Regards
Luca
>
>
> Anyway, fixing the points above would require moving some code around.
> Usually I try to avoid it, because it is not always easy to see
> associated side effects.
>
> CJ
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-11-23 7:32 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-20 12:35 [PATCH] interconnect: qcom: icc-rpmh: Fix an error handling path in qcom_icc_rpmh_probe() Christophe JAILLET
2022-11-21 7:42 ` Luca Weiss
2022-11-21 21:08 ` Christophe JAILLET
2022-11-22 21:45 ` Christophe JAILLET
2022-11-23 7:32 ` Luca Weiss
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).