* [PATCH 01/10] soc: qcom: aoss: Use __cleanup() for device_node pointers
2025-11-17 4:51 [PATCH 00/10] soc: qcom: Use __cleanup() for device_node pointers Kathiravan Thirumoorthy
@ 2025-11-17 4:51 ` Kathiravan Thirumoorthy
2025-11-17 11:35 ` Konrad Dybcio
2025-11-18 11:38 ` Krzysztof Kozlowski
2025-11-17 4:51 ` [PATCH 02/10] soc: qcom: gsbi: " Kathiravan Thirumoorthy
` (8 subsequent siblings)
9 siblings, 2 replies; 38+ messages in thread
From: Kathiravan Thirumoorthy @ 2025-11-17 4:51 UTC (permalink / raw)
To: Bjorn Andersson, Konrad Dybcio
Cc: linux-arm-msm, linux-kernel, Kathiravan Thirumoorthy
Make use of the __cleanup() attribute for device_node pointers to simplify
resource management and remove explicit of_node_put() calls.
Signed-off-by: Kathiravan Thirumoorthy <kathiravan.thirumoorthy@oss.qualcomm.com>
---
drivers/soc/qcom/qcom_aoss.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/soc/qcom/qcom_aoss.c b/drivers/soc/qcom/qcom_aoss.c
index a543ab9bee6c4efcbd7026c44af9731176d4d60c..cc9882009bcac7eae8db74815563cdf1cd9a5aa6 100644
--- a/drivers/soc/qcom/qcom_aoss.c
+++ b/drivers/soc/qcom/qcom_aoss.c
@@ -447,8 +447,8 @@ static void qmp_cooling_devices_remove(struct qmp *qmp)
*/
struct qmp *qmp_get(struct device *dev)
{
+ struct device_node *np __free(device_node) = NULL;
struct platform_device *pdev;
- struct device_node *np;
struct qmp *qmp;
if (!dev || !dev->of_node)
@@ -459,7 +459,6 @@ struct qmp *qmp_get(struct device *dev)
return ERR_PTR(-ENODEV);
pdev = of_find_device_by_node(np);
- of_node_put(np);
if (!pdev)
return ERR_PTR(-EINVAL);
--
2.34.1
^ permalink raw reply related [flat|nested] 38+ messages in thread* Re: [PATCH 01/10] soc: qcom: aoss: Use __cleanup() for device_node pointers
2025-11-17 4:51 ` [PATCH 01/10] soc: qcom: aoss: " Kathiravan Thirumoorthy
@ 2025-11-17 11:35 ` Konrad Dybcio
2025-11-18 11:39 ` Krzysztof Kozlowski
2025-11-18 11:38 ` Krzysztof Kozlowski
1 sibling, 1 reply; 38+ messages in thread
From: Konrad Dybcio @ 2025-11-17 11:35 UTC (permalink / raw)
To: Kathiravan Thirumoorthy, Bjorn Andersson, Konrad Dybcio
Cc: linux-arm-msm, linux-kernel
On 11/17/25 5:51 AM, Kathiravan Thirumoorthy wrote:
> Make use of the __cleanup() attribute for device_node pointers to simplify
> resource management and remove explicit of_node_put() calls.
>
> Signed-off-by: Kathiravan Thirumoorthy <kathiravan.thirumoorthy@oss.qualcomm.com>
> ---
Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Konrad
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH 01/10] soc: qcom: aoss: Use __cleanup() for device_node pointers
2025-11-17 11:35 ` Konrad Dybcio
@ 2025-11-18 11:39 ` Krzysztof Kozlowski
2025-11-18 12:25 ` Dmitry Baryshkov
0 siblings, 1 reply; 38+ messages in thread
From: Krzysztof Kozlowski @ 2025-11-18 11:39 UTC (permalink / raw)
To: Konrad Dybcio, Kathiravan Thirumoorthy, Bjorn Andersson,
Konrad Dybcio
Cc: linux-arm-msm, linux-kernel
On 17/11/2025 12:35, Konrad Dybcio wrote:
> On 11/17/25 5:51 AM, Kathiravan Thirumoorthy wrote:
>> Make use of the __cleanup() attribute for device_node pointers to simplify
>> resource management and remove explicit of_node_put() calls.
>>
>> Signed-off-by: Kathiravan Thirumoorthy <kathiravan.thirumoorthy@oss.qualcomm.com>
>> ---
>
> Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
This is obviously wrong and not helpful patch.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH 01/10] soc: qcom: aoss: Use __cleanup() for device_node pointers
2025-11-18 11:39 ` Krzysztof Kozlowski
@ 2025-11-18 12:25 ` Dmitry Baryshkov
2025-11-18 12:32 ` Krzysztof Kozlowski
0 siblings, 1 reply; 38+ messages in thread
From: Dmitry Baryshkov @ 2025-11-18 12:25 UTC (permalink / raw)
To: Krzysztof Kozlowski
Cc: Konrad Dybcio, Kathiravan Thirumoorthy, Bjorn Andersson,
Konrad Dybcio, linux-arm-msm, linux-kernel
On Tue, Nov 18, 2025 at 12:39:51PM +0100, Krzysztof Kozlowski wrote:
> On 17/11/2025 12:35, Konrad Dybcio wrote:
> > On 11/17/25 5:51 AM, Kathiravan Thirumoorthy wrote:
> >> Make use of the __cleanup() attribute for device_node pointers to simplify
> >> resource management and remove explicit of_node_put() calls.
> >>
> >> Signed-off-by: Kathiravan Thirumoorthy <kathiravan.thirumoorthy@oss.qualcomm.com>
> >> ---
> >
> > Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
>
> This is obviously wrong and not helpful patch.
Describing why it is wrong would be helpful (or having a pointer to an
explanation). Bear in mind people who read email archives and find this
very brief note.
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH 01/10] soc: qcom: aoss: Use __cleanup() for device_node pointers
2025-11-18 12:25 ` Dmitry Baryshkov
@ 2025-11-18 12:32 ` Krzysztof Kozlowski
2025-11-18 12:52 ` Dmitry Baryshkov
2025-11-18 15:18 ` Kathiravan Thirumoorthy
0 siblings, 2 replies; 38+ messages in thread
From: Krzysztof Kozlowski @ 2025-11-18 12:32 UTC (permalink / raw)
To: Dmitry Baryshkov
Cc: Konrad Dybcio, Kathiravan Thirumoorthy, Bjorn Andersson,
Konrad Dybcio, linux-arm-msm, linux-kernel
On 18/11/2025 13:25, Dmitry Baryshkov wrote:
> On Tue, Nov 18, 2025 at 12:39:51PM +0100, Krzysztof Kozlowski wrote:
>> On 17/11/2025 12:35, Konrad Dybcio wrote:
>>> On 11/17/25 5:51 AM, Kathiravan Thirumoorthy wrote:
>>>> Make use of the __cleanup() attribute for device_node pointers to simplify
>>>> resource management and remove explicit of_node_put() calls.
>>>>
>>>> Signed-off-by: Kathiravan Thirumoorthy <kathiravan.thirumoorthy@oss.qualcomm.com>
>>>> ---
>>>
>>> Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
>>
>> This is obviously wrong and not helpful patch.
>
> Describing why it is wrong would be helpful (or having a pointer to an
> explanation). Bear in mind people who read email archives and find this
> very brief note.
I gave some rationale in other patches, but summarizing:
1. It is against cleanup.h - author did not bother to read it - which
clearly asks for constructor with declaration. This was discussed many
times in the list, including many bugs and explicit checkpatch warning
(on LKML) because people don't bother to read cleanup.h.
2. It makes simple get+put code complicated, not simpler.
3. It grows the scope of OF reference without benefits.
4. This driver was already reviewed and simplified so author should go
back and think why this was left alone (would save a lot of trouble).
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH 01/10] soc: qcom: aoss: Use __cleanup() for device_node pointers
2025-11-18 12:32 ` Krzysztof Kozlowski
@ 2025-11-18 12:52 ` Dmitry Baryshkov
2025-11-18 13:16 ` Konrad Dybcio
2025-11-18 15:18 ` Kathiravan Thirumoorthy
1 sibling, 1 reply; 38+ messages in thread
From: Dmitry Baryshkov @ 2025-11-18 12:52 UTC (permalink / raw)
To: Krzysztof Kozlowski
Cc: Konrad Dybcio, Kathiravan Thirumoorthy, Bjorn Andersson,
Konrad Dybcio, linux-arm-msm, linux-kernel
On Tue, Nov 18, 2025 at 01:32:51PM +0100, Krzysztof Kozlowski wrote:
> On 18/11/2025 13:25, Dmitry Baryshkov wrote:
> > On Tue, Nov 18, 2025 at 12:39:51PM +0100, Krzysztof Kozlowski wrote:
> >> On 17/11/2025 12:35, Konrad Dybcio wrote:
> >>> On 11/17/25 5:51 AM, Kathiravan Thirumoorthy wrote:
> >>>> Make use of the __cleanup() attribute for device_node pointers to simplify
> >>>> resource management and remove explicit of_node_put() calls.
> >>>>
> >>>> Signed-off-by: Kathiravan Thirumoorthy <kathiravan.thirumoorthy@oss.qualcomm.com>
> >>>> ---
> >>>
> >>> Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
> >>
> >> This is obviously wrong and not helpful patch.
> >
> > Describing why it is wrong would be helpful (or having a pointer to an
> > explanation). Bear in mind people who read email archives and find this
> > very brief note.
>
> I gave some rationale in other patches, but summarizing:
> 1. It is against cleanup.h - author did not bother to read it - which
> clearly asks for constructor with declaration. This was discussed many
> times in the list, including many bugs and explicit checkpatch warning
> (on LKML) because people don't bother to read cleanup.h.
>
> 2. It makes simple get+put code complicated, not simpler.
>
> 3. It grows the scope of OF reference without benefits.
>
> 4. This driver was already reviewed and simplified so author should go
> back and think why this was left alone (would save a lot of trouble).
Thanks!
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH 01/10] soc: qcom: aoss: Use __cleanup() for device_node pointers
2025-11-18 12:52 ` Dmitry Baryshkov
@ 2025-11-18 13:16 ` Konrad Dybcio
2025-11-18 13:25 ` Krzysztof Kozlowski
0 siblings, 1 reply; 38+ messages in thread
From: Konrad Dybcio @ 2025-11-18 13:16 UTC (permalink / raw)
To: Dmitry Baryshkov, Krzysztof Kozlowski
Cc: Kathiravan Thirumoorthy, Bjorn Andersson, Konrad Dybcio,
linux-arm-msm, linux-kernel
On 11/18/25 1:52 PM, Dmitry Baryshkov wrote:
> On Tue, Nov 18, 2025 at 01:32:51PM +0100, Krzysztof Kozlowski wrote:
>> On 18/11/2025 13:25, Dmitry Baryshkov wrote:
>>> On Tue, Nov 18, 2025 at 12:39:51PM +0100, Krzysztof Kozlowski wrote:
>>>> On 17/11/2025 12:35, Konrad Dybcio wrote:
>>>>> On 11/17/25 5:51 AM, Kathiravan Thirumoorthy wrote:
>>>>>> Make use of the __cleanup() attribute for device_node pointers to simplify
>>>>>> resource management and remove explicit of_node_put() calls.
>>>>>>
>>>>>> Signed-off-by: Kathiravan Thirumoorthy <kathiravan.thirumoorthy@oss.qualcomm.com>
>>>>>> ---
>>>>>
>>>>> Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
>>>>
>>>> This is obviously wrong and not helpful patch.
>>>
>>> Describing why it is wrong would be helpful (or having a pointer to an
>>> explanation). Bear in mind people who read email archives and find this
>>> very brief note.
>>
>> I gave some rationale in other patches, but summarizing:
>> 1. It is against cleanup.h - author did not bother to read it - which
>> clearly asks for constructor with declaration. This was discussed many
>> times in the list, including many bugs and explicit checkpatch warning
>> (on LKML) because people don't bother to read cleanup.h.
Looks like I didn't read it either.. now that I did, I see that
_free(x) = NULL is somewhat of an anti-pattern, but none of these
patches seem to introduce any bugs related to it
>> 2. It makes simple get+put code complicated, not simpler.
Here I tend to disagree..
>> 3. It grows the scope of OF reference without benefits.
This makes sense
Ultimately as you've noticed, this is mostly a cosmetic change and
I don't mind it going either way
Konrad
>> 4. This driver was already reviewed and simplified so author should go
>> back and think why this was left alone (would save a lot of trouble).
>
> Thanks!
>
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH 01/10] soc: qcom: aoss: Use __cleanup() for device_node pointers
2025-11-18 13:16 ` Konrad Dybcio
@ 2025-11-18 13:25 ` Krzysztof Kozlowski
0 siblings, 0 replies; 38+ messages in thread
From: Krzysztof Kozlowski @ 2025-11-18 13:25 UTC (permalink / raw)
To: Konrad Dybcio, Dmitry Baryshkov
Cc: Kathiravan Thirumoorthy, Bjorn Andersson, Konrad Dybcio,
linux-arm-msm, linux-kernel
On 18/11/2025 14:16, Konrad Dybcio wrote:
> On 11/18/25 1:52 PM, Dmitry Baryshkov wrote:
>> On Tue, Nov 18, 2025 at 01:32:51PM +0100, Krzysztof Kozlowski wrote:
>>> On 18/11/2025 13:25, Dmitry Baryshkov wrote:
>>>> On Tue, Nov 18, 2025 at 12:39:51PM +0100, Krzysztof Kozlowski wrote:
>>>>> On 17/11/2025 12:35, Konrad Dybcio wrote:
>>>>>> On 11/17/25 5:51 AM, Kathiravan Thirumoorthy wrote:
>>>>>>> Make use of the __cleanup() attribute for device_node pointers to simplify
>>>>>>> resource management and remove explicit of_node_put() calls.
>>>>>>>
>>>>>>> Signed-off-by: Kathiravan Thirumoorthy <kathiravan.thirumoorthy@oss.qualcomm.com>
>>>>>>> ---
>>>>>>
>>>>>> Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
>>>>>
>>>>> This is obviously wrong and not helpful patch.
>>>>
>>>> Describing why it is wrong would be helpful (or having a pointer to an
>>>> explanation). Bear in mind people who read email archives and find this
>>>> very brief note.
>>>
>>> I gave some rationale in other patches, but summarizing:
>>> 1. It is against cleanup.h - author did not bother to read it - which
>>> clearly asks for constructor with declaration. This was discussed many
>>> times in the list, including many bugs and explicit checkpatch warning
>>> (on LKML) because people don't bother to read cleanup.h.
>
> Looks like I didn't read it either.. now that I did, I see that
> _free(x) = NULL is somewhat of an anti-pattern, but none of these
True
> patches seem to introduce any bugs related to it
True
>
>>> 2. It makes simple get+put code complicated, not simpler.
>
> Here I tend to disagree..
of_get and immediate of_put is really obvious and easy to read. It is
really a common pattern.
OTOH code like:
struct device_node *np = of_parse_whatever_which_is_get()
...
bunch of code here where np is actually used.
...
... more code
return;
is not simple. The lifecycle of this variable becomes very long and
where it is acquired - at beginning - causes question - why do you need
to acquire it there?
That's why cleanup.h has VERY specific syntax different than rest of kernel.
If contributor does not know this syntax, don't send the patches. They
are wrong.
>
>>> 3. It grows the scope of OF reference without benefits.
>
> This makes sense
>
> Ultimately as you've noticed, this is mostly a cosmetic change and
> I don't mind it going either way
It is not cosmetic. It is anti-pattern.
Anti-patterns, even without introducing bugs, make the code WORSE to
maintain. Worse code is not cosmetic.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH 01/10] soc: qcom: aoss: Use __cleanup() for device_node pointers
2025-11-18 12:32 ` Krzysztof Kozlowski
2025-11-18 12:52 ` Dmitry Baryshkov
@ 2025-11-18 15:18 ` Kathiravan Thirumoorthy
1 sibling, 0 replies; 38+ messages in thread
From: Kathiravan Thirumoorthy @ 2025-11-18 15:18 UTC (permalink / raw)
To: Krzysztof Kozlowski, Dmitry Baryshkov
Cc: Konrad Dybcio, Bjorn Andersson, Konrad Dybcio, linux-arm-msm,
linux-kernel
On 11/18/2025 6:02 PM, Krzysztof Kozlowski wrote:
> On 18/11/2025 13:25, Dmitry Baryshkov wrote:
>> On Tue, Nov 18, 2025 at 12:39:51PM +0100, Krzysztof Kozlowski wrote:
>>> On 17/11/2025 12:35, Konrad Dybcio wrote:
>>>> On 11/17/25 5:51 AM, Kathiravan Thirumoorthy wrote:
>>>>> Make use of the __cleanup() attribute for device_node pointers to simplify
>>>>> resource management and remove explicit of_node_put() calls.
>>>>>
>>>>> Signed-off-by: Kathiravan Thirumoorthy <kathiravan.thirumoorthy@oss.qualcomm.com>
>>>>> ---
>>>> Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
>>> This is obviously wrong and not helpful patch.
>> Describing why it is wrong would be helpful (or having a pointer to an
>> explanation). Bear in mind people who read email archives and find this
>> very brief note.
> I gave some rationale in other patches, but summarizing:
> 1. It is against cleanup.h - author did not bother to read it - which
> clearly asks for constructor with declaration.
Thanks for pointing this out. I understood that w/o NULL initialization
we will be freeing some dangling pointers but looks like there are other
cases also. I agree that I overlooked the details in cleanup.h.Apologies
for the oversight and for taking up everyone’s time. Will take care of
this going forward!
> This was discussed many
> times in the list, including many bugs and explicit checkpatch warning
> (on LKML) because people don't bother to read cleanup.h.
>
> 2. It makes simple get+put code complicated, not simpler.
>
> 3. It grows the scope of OF reference without benefits.
>
> 4. This driver was already reviewed and simplified so author should go
> back and think why this was left alone (would save a lot of trouble).
>
> Best regards,
> Krzysztof
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH 01/10] soc: qcom: aoss: Use __cleanup() for device_node pointers
2025-11-17 4:51 ` [PATCH 01/10] soc: qcom: aoss: " Kathiravan Thirumoorthy
2025-11-17 11:35 ` Konrad Dybcio
@ 2025-11-18 11:38 ` Krzysztof Kozlowski
1 sibling, 0 replies; 38+ messages in thread
From: Krzysztof Kozlowski @ 2025-11-18 11:38 UTC (permalink / raw)
To: Kathiravan Thirumoorthy, Bjorn Andersson, Konrad Dybcio
Cc: linux-arm-msm, linux-kernel
On 17/11/2025 05:51, Kathiravan Thirumoorthy wrote:
> Make use of the __cleanup() attribute for device_node pointers to simplify
> resource management and remove explicit of_node_put() calls.
>
> Signed-off-by: Kathiravan Thirumoorthy <kathiravan.thirumoorthy@oss.qualcomm.com>
> ---
> drivers/soc/qcom/qcom_aoss.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/soc/qcom/qcom_aoss.c b/drivers/soc/qcom/qcom_aoss.c
> index a543ab9bee6c4efcbd7026c44af9731176d4d60c..cc9882009bcac7eae8db74815563cdf1cd9a5aa6 100644
> --- a/drivers/soc/qcom/qcom_aoss.c
> +++ b/drivers/soc/qcom/qcom_aoss.c
> @@ -447,8 +447,8 @@ static void qmp_cooling_devices_remove(struct qmp *qmp)
> */
> struct qmp *qmp_get(struct device *dev)
> {
> + struct device_node *np __free(device_node) = NULL;
NAK, same reasons
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 02/10] soc: qcom: gsbi: Use __cleanup() for device_node pointers
2025-11-17 4:51 [PATCH 00/10] soc: qcom: Use __cleanup() for device_node pointers Kathiravan Thirumoorthy
2025-11-17 4:51 ` [PATCH 01/10] soc: qcom: aoss: " Kathiravan Thirumoorthy
@ 2025-11-17 4:51 ` Kathiravan Thirumoorthy
2025-11-17 11:35 ` Konrad Dybcio
2025-11-18 11:38 ` Krzysztof Kozlowski
2025-11-17 4:51 ` [PATCH 03/10] soc: qcom: pd-mapper: " Kathiravan Thirumoorthy
` (7 subsequent siblings)
9 siblings, 2 replies; 38+ messages in thread
From: Kathiravan Thirumoorthy @ 2025-11-17 4:51 UTC (permalink / raw)
To: Bjorn Andersson, Konrad Dybcio
Cc: linux-arm-msm, linux-kernel, Kathiravan Thirumoorthy
Apply the __cleanup() attribute to device_node pointers to simplify
resource management and remove explicit of_node_put() calls.
Signed-off-by: Kathiravan Thirumoorthy <kathiravan.thirumoorthy@oss.qualcomm.com>
---
drivers/soc/qcom/qcom_gsbi.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/soc/qcom/qcom_gsbi.c b/drivers/soc/qcom/qcom_gsbi.c
index a25d1de592f060bbf6e084bd412e3a1ef47558f4..4a195c39e223c1f4cda1becf4542d4c8a79ad688 100644
--- a/drivers/soc/qcom/qcom_gsbi.c
+++ b/drivers/soc/qcom/qcom_gsbi.c
@@ -124,8 +124,8 @@ static const struct of_device_id tcsr_dt_match[] __maybe_unused = {
static int gsbi_probe(struct platform_device *pdev)
{
+ struct device_node *tcsr_node __free(device_node) = NULL;
struct device_node *node = pdev->dev.of_node;
- struct device_node *tcsr_node;
const struct of_device_id *match;
void __iomem *base;
struct gsbi_info *gsbi;
@@ -154,7 +154,6 @@ static int gsbi_probe(struct platform_device *pdev)
else
dev_warn(&pdev->dev, "no matching TCSR\n");
- of_node_put(tcsr_node);
}
}
--
2.34.1
^ permalink raw reply related [flat|nested] 38+ messages in thread* Re: [PATCH 02/10] soc: qcom: gsbi: Use __cleanup() for device_node pointers
2025-11-17 4:51 ` [PATCH 02/10] soc: qcom: gsbi: " Kathiravan Thirumoorthy
@ 2025-11-17 11:35 ` Konrad Dybcio
2025-11-18 11:38 ` Krzysztof Kozlowski
1 sibling, 0 replies; 38+ messages in thread
From: Konrad Dybcio @ 2025-11-17 11:35 UTC (permalink / raw)
To: Kathiravan Thirumoorthy, Bjorn Andersson, Konrad Dybcio
Cc: linux-arm-msm, linux-kernel
On 11/17/25 5:51 AM, Kathiravan Thirumoorthy wrote:
> Apply the __cleanup() attribute to device_node pointers to simplify
> resource management and remove explicit of_node_put() calls.
>
> Signed-off-by: Kathiravan Thirumoorthy <kathiravan.thirumoorthy@oss.qualcomm.com>
> ---
Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Konrad
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH 02/10] soc: qcom: gsbi: Use __cleanup() for device_node pointers
2025-11-17 4:51 ` [PATCH 02/10] soc: qcom: gsbi: " Kathiravan Thirumoorthy
2025-11-17 11:35 ` Konrad Dybcio
@ 2025-11-18 11:38 ` Krzysztof Kozlowski
1 sibling, 0 replies; 38+ messages in thread
From: Krzysztof Kozlowski @ 2025-11-18 11:38 UTC (permalink / raw)
To: Kathiravan Thirumoorthy, Bjorn Andersson, Konrad Dybcio
Cc: linux-arm-msm, linux-kernel
On 17/11/2025 05:51, Kathiravan Thirumoorthy wrote:
> Apply the __cleanup() attribute to device_node pointers to simplify
> resource management and remove explicit of_node_put() calls.
>
> Signed-off-by: Kathiravan Thirumoorthy <kathiravan.thirumoorthy@oss.qualcomm.com>
> ---
> drivers/soc/qcom/qcom_gsbi.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/soc/qcom/qcom_gsbi.c b/drivers/soc/qcom/qcom_gsbi.c
> index a25d1de592f060bbf6e084bd412e3a1ef47558f4..4a195c39e223c1f4cda1becf4542d4c8a79ad688 100644
> --- a/drivers/soc/qcom/qcom_gsbi.c
> +++ b/drivers/soc/qcom/qcom_gsbi.c
> @@ -124,8 +124,8 @@ static const struct of_device_id tcsr_dt_match[] __maybe_unused = {
>
> static int gsbi_probe(struct platform_device *pdev)
> {
> + struct device_node *tcsr_node __free(device_node) = NULL;
NAK. Read first how cleanup.h is supposed to look like and why this
wasn't changed with my patches before.
> struct device_node *node = pdev->dev.of_node;
> - struct device_node *tcsr_node;
> const struct of_device_id *match;
> void __iomem *base;
> struct gsbi_info *gsbi;
> @@ -154,7 +154,6 @@ static int gsbi_probe(struct platform_device *pdev)
> else
> dev_warn(&pdev->dev, "no matching TCSR\n");
>
> - of_node_put(tcsr_node);
> }
> }
>
>
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 03/10] soc: qcom: pd-mapper: Use __cleanup() for device_node pointers
2025-11-17 4:51 [PATCH 00/10] soc: qcom: Use __cleanup() for device_node pointers Kathiravan Thirumoorthy
2025-11-17 4:51 ` [PATCH 01/10] soc: qcom: aoss: " Kathiravan Thirumoorthy
2025-11-17 4:51 ` [PATCH 02/10] soc: qcom: gsbi: " Kathiravan Thirumoorthy
@ 2025-11-17 4:51 ` Kathiravan Thirumoorthy
2025-11-17 11:36 ` Konrad Dybcio
2025-11-18 11:43 ` Krzysztof Kozlowski
2025-11-17 4:51 ` [PATCH 04/10] soc: qcom: rpm-proc: " Kathiravan Thirumoorthy
` (6 subsequent siblings)
9 siblings, 2 replies; 38+ messages in thread
From: Kathiravan Thirumoorthy @ 2025-11-17 4:51 UTC (permalink / raw)
To: Bjorn Andersson, Konrad Dybcio
Cc: linux-arm-msm, linux-kernel, Kathiravan Thirumoorthy
Apply the __cleanup() attribute to device_node pointers to simplify
resource management and remove explicit of_node_put() calls.
Signed-off-by: Kathiravan Thirumoorthy <kathiravan.thirumoorthy@oss.qualcomm.com>
---
drivers/soc/qcom/qcom_pd_mapper.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/soc/qcom/qcom_pd_mapper.c b/drivers/soc/qcom/qcom_pd_mapper.c
index 1bcbe69688d2bc2559a1395929e5cd74d9a7a764..5713029d6527c84e8ba410cebb67bc268c6b3721 100644
--- a/drivers/soc/qcom/qcom_pd_mapper.c
+++ b/drivers/soc/qcom/qcom_pd_mapper.c
@@ -612,10 +612,10 @@ static void qcom_pdm_stop(struct qcom_pdm_data *data)
static struct qcom_pdm_data *qcom_pdm_start(void)
{
+ struct device_node *root __free(device_node) = NULL;
const struct qcom_pdm_domain_data * const *domains;
const struct of_device_id *match;
struct qcom_pdm_data *data;
- struct device_node *root;
int ret, i;
root = of_find_node_by_path("/");
@@ -623,7 +623,6 @@ static struct qcom_pdm_data *qcom_pdm_start(void)
return ERR_PTR(-ENODEV);
match = of_match_node(qcom_pdm_domains, root);
- of_node_put(root);
if (!match) {
pr_notice("PDM: no support for the platform, userspace daemon might be required.\n");
return ERR_PTR(-ENODEV);
--
2.34.1
^ permalink raw reply related [flat|nested] 38+ messages in thread* Re: [PATCH 03/10] soc: qcom: pd-mapper: Use __cleanup() for device_node pointers
2025-11-17 4:51 ` [PATCH 03/10] soc: qcom: pd-mapper: " Kathiravan Thirumoorthy
@ 2025-11-17 11:36 ` Konrad Dybcio
2025-11-18 11:43 ` Krzysztof Kozlowski
1 sibling, 0 replies; 38+ messages in thread
From: Konrad Dybcio @ 2025-11-17 11:36 UTC (permalink / raw)
To: Kathiravan Thirumoorthy, Bjorn Andersson, Konrad Dybcio
Cc: linux-arm-msm, linux-kernel
On 11/17/25 5:51 AM, Kathiravan Thirumoorthy wrote:
> Apply the __cleanup() attribute to device_node pointers to simplify
> resource management and remove explicit of_node_put() calls.
>
> Signed-off-by: Kathiravan Thirumoorthy <kathiravan.thirumoorthy@oss.qualcomm.com>
> ---
Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Konrad
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH 03/10] soc: qcom: pd-mapper: Use __cleanup() for device_node pointers
2025-11-17 4:51 ` [PATCH 03/10] soc: qcom: pd-mapper: " Kathiravan Thirumoorthy
2025-11-17 11:36 ` Konrad Dybcio
@ 2025-11-18 11:43 ` Krzysztof Kozlowski
1 sibling, 0 replies; 38+ messages in thread
From: Krzysztof Kozlowski @ 2025-11-18 11:43 UTC (permalink / raw)
To: Kathiravan Thirumoorthy, Bjorn Andersson, Konrad Dybcio
Cc: linux-arm-msm, linux-kernel
On 17/11/2025 05:51, Kathiravan Thirumoorthy wrote:
> Apply the __cleanup() attribute to device_node pointers to simplify
> resource management and remove explicit of_node_put() calls.
>
> Signed-off-by: Kathiravan Thirumoorthy <kathiravan.thirumoorthy@oss.qualcomm.com>
> ---
> drivers/soc/qcom/qcom_pd_mapper.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/soc/qcom/qcom_pd_mapper.c b/drivers/soc/qcom/qcom_pd_mapper.c
> index 1bcbe69688d2bc2559a1395929e5cd74d9a7a764..5713029d6527c84e8ba410cebb67bc268c6b3721 100644
> --- a/drivers/soc/qcom/qcom_pd_mapper.c
> +++ b/drivers/soc/qcom/qcom_pd_mapper.c
> @@ -612,10 +612,10 @@ static void qcom_pdm_stop(struct qcom_pdm_data *data)
>
> static struct qcom_pdm_data *qcom_pdm_start(void)
> {
> + struct device_node *root __free(device_node) = NULL;
NAK
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 04/10] soc: qcom: rpm-proc: Use __cleanup() for device_node pointers
2025-11-17 4:51 [PATCH 00/10] soc: qcom: Use __cleanup() for device_node pointers Kathiravan Thirumoorthy
` (2 preceding siblings ...)
2025-11-17 4:51 ` [PATCH 03/10] soc: qcom: pd-mapper: " Kathiravan Thirumoorthy
@ 2025-11-17 4:51 ` Kathiravan Thirumoorthy
2025-11-17 11:36 ` Konrad Dybcio
2025-11-18 11:40 ` Krzysztof Kozlowski
2025-11-17 4:51 ` [PATCH 05/10] soc: qcom: rpm_master_stats: " Kathiravan Thirumoorthy
` (5 subsequent siblings)
9 siblings, 2 replies; 38+ messages in thread
From: Kathiravan Thirumoorthy @ 2025-11-17 4:51 UTC (permalink / raw)
To: Bjorn Andersson, Konrad Dybcio
Cc: linux-arm-msm, linux-kernel, Kathiravan Thirumoorthy
Apply the __cleanup() attribute to device_node pointers to simplify
resource management and remove explicit of_node_put() calls.
Signed-off-by: Kathiravan Thirumoorthy <kathiravan.thirumoorthy@oss.qualcomm.com>
---
drivers/soc/qcom/rpm-proc.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/soc/qcom/rpm-proc.c b/drivers/soc/qcom/rpm-proc.c
index 2466d0400c2e9a539e0b1009ee1bfefc3bd1b589..6f0c9f2558b06323c1100caa4544872badc22599 100644
--- a/drivers/soc/qcom/rpm-proc.c
+++ b/drivers/soc/qcom/rpm-proc.c
@@ -9,15 +9,14 @@
static int rpm_proc_probe(struct platform_device *pdev)
{
+ struct device_node *edge_node __free(device_node) = NULL;
struct qcom_smd_edge *edge = NULL;
struct device *dev = &pdev->dev;
- struct device_node *edge_node;
int ret;
edge_node = of_get_child_by_name(dev->of_node, "smd-edge");
if (edge_node) {
edge = qcom_smd_register_edge(dev, edge_node);
- of_node_put(edge_node);
if (IS_ERR(edge))
return dev_err_probe(dev, PTR_ERR(edge),
"Failed to register smd-edge\n");
--
2.34.1
^ permalink raw reply related [flat|nested] 38+ messages in thread* Re: [PATCH 04/10] soc: qcom: rpm-proc: Use __cleanup() for device_node pointers
2025-11-17 4:51 ` [PATCH 04/10] soc: qcom: rpm-proc: " Kathiravan Thirumoorthy
@ 2025-11-17 11:36 ` Konrad Dybcio
2025-11-18 11:40 ` Krzysztof Kozlowski
1 sibling, 0 replies; 38+ messages in thread
From: Konrad Dybcio @ 2025-11-17 11:36 UTC (permalink / raw)
To: Kathiravan Thirumoorthy, Bjorn Andersson, Konrad Dybcio
Cc: linux-arm-msm, linux-kernel
On 11/17/25 5:51 AM, Kathiravan Thirumoorthy wrote:
> Apply the __cleanup() attribute to device_node pointers to simplify
> resource management and remove explicit of_node_put() calls.
>
> Signed-off-by: Kathiravan Thirumoorthy <kathiravan.thirumoorthy@oss.qualcomm.com>
> ---
Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Konrad
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH 04/10] soc: qcom: rpm-proc: Use __cleanup() for device_node pointers
2025-11-17 4:51 ` [PATCH 04/10] soc: qcom: rpm-proc: " Kathiravan Thirumoorthy
2025-11-17 11:36 ` Konrad Dybcio
@ 2025-11-18 11:40 ` Krzysztof Kozlowski
1 sibling, 0 replies; 38+ messages in thread
From: Krzysztof Kozlowski @ 2025-11-18 11:40 UTC (permalink / raw)
To: Kathiravan Thirumoorthy, Bjorn Andersson, Konrad Dybcio
Cc: linux-arm-msm, linux-kernel
On 17/11/2025 05:51, Kathiravan Thirumoorthy wrote:
> Apply the __cleanup() attribute to device_node pointers to simplify
> resource management and remove explicit of_node_put() calls.
>
> Signed-off-by: Kathiravan Thirumoorthy <kathiravan.thirumoorthy@oss.qualcomm.com>
> ---
> drivers/soc/qcom/rpm-proc.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/soc/qcom/rpm-proc.c b/drivers/soc/qcom/rpm-proc.c
> index 2466d0400c2e9a539e0b1009ee1bfefc3bd1b589..6f0c9f2558b06323c1100caa4544872badc22599 100644
> --- a/drivers/soc/qcom/rpm-proc.c
> +++ b/drivers/soc/qcom/rpm-proc.c
> @@ -9,15 +9,14 @@
>
> static int rpm_proc_probe(struct platform_device *pdev)
> {
> + struct device_node *edge_node __free(device_node) = NULL;
NAK, stop with this pattern.
You are not simplifying anything here!
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 05/10] soc: qcom: rpm_master_stats: Use __cleanup() for device_node pointers
2025-11-17 4:51 [PATCH 00/10] soc: qcom: Use __cleanup() for device_node pointers Kathiravan Thirumoorthy
` (3 preceding siblings ...)
2025-11-17 4:51 ` [PATCH 04/10] soc: qcom: rpm-proc: " Kathiravan Thirumoorthy
@ 2025-11-17 4:51 ` Kathiravan Thirumoorthy
2025-11-17 11:37 ` Konrad Dybcio
2025-11-18 11:40 ` Krzysztof Kozlowski
2025-11-17 4:51 ` [PATCH 06/10] soc: qcom: smem: " Kathiravan Thirumoorthy
` (4 subsequent siblings)
9 siblings, 2 replies; 38+ messages in thread
From: Kathiravan Thirumoorthy @ 2025-11-17 4:51 UTC (permalink / raw)
To: Bjorn Andersson, Konrad Dybcio
Cc: linux-arm-msm, linux-kernel, Kathiravan Thirumoorthy
Apply the __cleanup() attribute to device_node pointers to simplify
resource management and remove explicit of_node_put() calls.
Signed-off-by: Kathiravan Thirumoorthy <kathiravan.thirumoorthy@oss.qualcomm.com>
---
drivers/soc/qcom/rpm_master_stats.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/soc/qcom/rpm_master_stats.c b/drivers/soc/qcom/rpm_master_stats.c
index c7788337e1647da386e874bcb87313e8f07241df..06a1d3fe5e9b4295018b0e5cbcf738c0e9e83c3b 100644
--- a/drivers/soc/qcom/rpm_master_stats.c
+++ b/drivers/soc/qcom/rpm_master_stats.c
@@ -67,9 +67,9 @@ DEFINE_SHOW_ATTRIBUTE(master_stats);
static int master_stats_probe(struct platform_device *pdev)
{
+ struct device_node *msgram_np __free(device_node) = NULL;
struct device *dev = &pdev->dev;
struct master_stats_data *data;
- struct device_node *msgram_np;
struct dentry *dent, *root;
struct resource res;
int count, i, ret;
@@ -98,7 +98,6 @@ static int master_stats_probe(struct platform_device *pdev)
* shared resource.
*/
ret = of_address_to_resource(msgram_np, 0, &res);
- of_node_put(msgram_np);
if (ret < 0) {
debugfs_remove_recursive(root);
return ret;
--
2.34.1
^ permalink raw reply related [flat|nested] 38+ messages in thread* Re: [PATCH 05/10] soc: qcom: rpm_master_stats: Use __cleanup() for device_node pointers
2025-11-17 4:51 ` [PATCH 05/10] soc: qcom: rpm_master_stats: " Kathiravan Thirumoorthy
@ 2025-11-17 11:37 ` Konrad Dybcio
2025-11-18 11:40 ` Krzysztof Kozlowski
1 sibling, 0 replies; 38+ messages in thread
From: Konrad Dybcio @ 2025-11-17 11:37 UTC (permalink / raw)
To: Kathiravan Thirumoorthy, Bjorn Andersson, Konrad Dybcio
Cc: linux-arm-msm, linux-kernel
On 11/17/25 5:51 AM, Kathiravan Thirumoorthy wrote:
> Apply the __cleanup() attribute to device_node pointers to simplify
> resource management and remove explicit of_node_put() calls.
>
> Signed-off-by: Kathiravan Thirumoorthy <kathiravan.thirumoorthy@oss.qualcomm.com>
> ---
Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Konrad
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH 05/10] soc: qcom: rpm_master_stats: Use __cleanup() for device_node pointers
2025-11-17 4:51 ` [PATCH 05/10] soc: qcom: rpm_master_stats: " Kathiravan Thirumoorthy
2025-11-17 11:37 ` Konrad Dybcio
@ 2025-11-18 11:40 ` Krzysztof Kozlowski
1 sibling, 0 replies; 38+ messages in thread
From: Krzysztof Kozlowski @ 2025-11-18 11:40 UTC (permalink / raw)
To: Kathiravan Thirumoorthy, Bjorn Andersson, Konrad Dybcio
Cc: linux-arm-msm, linux-kernel
On 17/11/2025 05:51, Kathiravan Thirumoorthy wrote:
> Apply the __cleanup() attribute to device_node pointers to simplify
> resource management and remove explicit of_node_put() calls.
>
> Signed-off-by: Kathiravan Thirumoorthy <kathiravan.thirumoorthy@oss.qualcomm.com>
> ---
> drivers/soc/qcom/rpm_master_stats.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/soc/qcom/rpm_master_stats.c b/drivers/soc/qcom/rpm_master_stats.c
> index c7788337e1647da386e874bcb87313e8f07241df..06a1d3fe5e9b4295018b0e5cbcf738c0e9e83c3b 100644
> --- a/drivers/soc/qcom/rpm_master_stats.c
> +++ b/drivers/soc/qcom/rpm_master_stats.c
> @@ -67,9 +67,9 @@ DEFINE_SHOW_ATTRIBUTE(master_stats);
>
> static int master_stats_probe(struct platform_device *pdev)
> {
> + struct device_node *msgram_np __free(device_node) = NULL;
NAK, stop with this pattern.
You are not simplifying anything here!
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 06/10] soc: qcom: smem: Use __cleanup() for device_node pointers
2025-11-17 4:51 [PATCH 00/10] soc: qcom: Use __cleanup() for device_node pointers Kathiravan Thirumoorthy
` (4 preceding siblings ...)
2025-11-17 4:51 ` [PATCH 05/10] soc: qcom: rpm_master_stats: " Kathiravan Thirumoorthy
@ 2025-11-17 4:51 ` Kathiravan Thirumoorthy
2025-11-17 11:37 ` Konrad Dybcio
2025-11-18 11:42 ` Krzysztof Kozlowski
2025-11-17 4:51 ` [PATCH 07/10] soc: qcom: smp2p: " Kathiravan Thirumoorthy
` (3 subsequent siblings)
9 siblings, 2 replies; 38+ messages in thread
From: Kathiravan Thirumoorthy @ 2025-11-17 4:51 UTC (permalink / raw)
To: Bjorn Andersson, Konrad Dybcio
Cc: linux-arm-msm, linux-kernel, Kathiravan Thirumoorthy
Apply the __cleanup() attribute to device_node pointers to simplify
resource management and remove explicit of_node_put() calls.
Signed-off-by: Kathiravan Thirumoorthy <kathiravan.thirumoorthy@oss.qualcomm.com>
---
drivers/soc/qcom/smem.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/soc/qcom/smem.c b/drivers/soc/qcom/smem.c
index fef840b5457407a85051ded0e835430dbebfe8bb..6c3a08e1afe824402f6fbb84c9695ee57eda230b 100644
--- a/drivers/soc/qcom/smem.c
+++ b/drivers/soc/qcom/smem.c
@@ -1100,8 +1100,8 @@ static int qcom_smem_map_global(struct qcom_smem *smem, u32 size)
static int qcom_smem_resolve_mem(struct qcom_smem *smem, const char *name,
struct smem_region *region)
{
+ struct device_node *np __free(device_node) = NULL;
struct device *dev = smem->dev;
- struct device_node *np;
struct resource r;
int ret;
@@ -1112,7 +1112,6 @@ static int qcom_smem_resolve_mem(struct qcom_smem *smem, const char *name,
}
ret = of_address_to_resource(np, 0, &r);
- of_node_put(np);
if (ret)
return ret;
--
2.34.1
^ permalink raw reply related [flat|nested] 38+ messages in thread* Re: [PATCH 06/10] soc: qcom: smem: Use __cleanup() for device_node pointers
2025-11-17 4:51 ` [PATCH 06/10] soc: qcom: smem: " Kathiravan Thirumoorthy
@ 2025-11-17 11:37 ` Konrad Dybcio
2025-11-18 11:42 ` Krzysztof Kozlowski
1 sibling, 0 replies; 38+ messages in thread
From: Konrad Dybcio @ 2025-11-17 11:37 UTC (permalink / raw)
To: Kathiravan Thirumoorthy, Bjorn Andersson, Konrad Dybcio
Cc: linux-arm-msm, linux-kernel
On 11/17/25 5:51 AM, Kathiravan Thirumoorthy wrote:
> Apply the __cleanup() attribute to device_node pointers to simplify
> resource management and remove explicit of_node_put() calls.
>
> Signed-off-by: Kathiravan Thirumoorthy <kathiravan.thirumoorthy@oss.qualcomm.com>
> ---
Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Konrad
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH 06/10] soc: qcom: smem: Use __cleanup() for device_node pointers
2025-11-17 4:51 ` [PATCH 06/10] soc: qcom: smem: " Kathiravan Thirumoorthy
2025-11-17 11:37 ` Konrad Dybcio
@ 2025-11-18 11:42 ` Krzysztof Kozlowski
1 sibling, 0 replies; 38+ messages in thread
From: Krzysztof Kozlowski @ 2025-11-18 11:42 UTC (permalink / raw)
To: Kathiravan Thirumoorthy, Bjorn Andersson, Konrad Dybcio
Cc: linux-arm-msm, linux-kernel
On 17/11/2025 05:51, Kathiravan Thirumoorthy wrote:
> Apply the __cleanup() attribute to device_node pointers to simplify
> resource management and remove explicit of_node_put() calls.
>
> Signed-off-by: Kathiravan Thirumoorthy <kathiravan.thirumoorthy@oss.qualcomm.com>
> ---
> drivers/soc/qcom/smem.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/soc/qcom/smem.c b/drivers/soc/qcom/smem.c
> index fef840b5457407a85051ded0e835430dbebfe8bb..6c3a08e1afe824402f6fbb84c9695ee57eda230b 100644
> --- a/drivers/soc/qcom/smem.c
> +++ b/drivers/soc/qcom/smem.c
> @@ -1100,8 +1100,8 @@ static int qcom_smem_map_global(struct qcom_smem *smem, u32 size)
> static int qcom_smem_resolve_mem(struct qcom_smem *smem, const char *name,
> struct smem_region *region)
> {
> + struct device_node *np __free(device_node) = NULL;
Absolutely none of your patches is correct. ZERO. You did not understand
how cleanup.h works but decided to send all of this.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 07/10] soc: qcom: smp2p: Use __cleanup() for device_node pointers
2025-11-17 4:51 [PATCH 00/10] soc: qcom: Use __cleanup() for device_node pointers Kathiravan Thirumoorthy
` (5 preceding siblings ...)
2025-11-17 4:51 ` [PATCH 06/10] soc: qcom: smem: " Kathiravan Thirumoorthy
@ 2025-11-17 4:51 ` Kathiravan Thirumoorthy
2025-11-17 11:37 ` Konrad Dybcio
2025-11-18 11:41 ` Krzysztof Kozlowski
2025-11-17 4:51 ` [PATCH 08/10] soc: qcom: smsm: " Kathiravan Thirumoorthy
` (2 subsequent siblings)
9 siblings, 2 replies; 38+ messages in thread
From: Kathiravan Thirumoorthy @ 2025-11-17 4:51 UTC (permalink / raw)
To: Bjorn Andersson, Konrad Dybcio
Cc: linux-arm-msm, linux-kernel, Kathiravan Thirumoorthy
Apply the __cleanup() attribute to device_node pointers to simplify
resource management and remove explicit of_node_put() calls.
Signed-off-by: Kathiravan Thirumoorthy <kathiravan.thirumoorthy@oss.qualcomm.com>
---
drivers/soc/qcom/smp2p.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/soc/qcom/smp2p.c b/drivers/soc/qcom/smp2p.c
index cb515c2340c107e92ece1bb8cd3854abf9f03e4a..2e22eb4728b7412685138fc86e55058b047bcb75 100644
--- a/drivers/soc/qcom/smp2p.c
+++ b/drivers/soc/qcom/smp2p.c
@@ -501,7 +501,7 @@ static int qcom_smp2p_alloc_outbound_item(struct qcom_smp2p *smp2p)
static int smp2p_parse_ipc(struct qcom_smp2p *smp2p)
{
- struct device_node *syscon;
+ struct device_node *syscon __free(device_node) = NULL;
struct device *dev = smp2p->dev;
const char *key;
int ret;
@@ -513,7 +513,6 @@ static int smp2p_parse_ipc(struct qcom_smp2p *smp2p)
}
smp2p->ipc_regmap = syscon_node_to_regmap(syscon);
- of_node_put(syscon);
if (IS_ERR(smp2p->ipc_regmap))
return PTR_ERR(smp2p->ipc_regmap);
--
2.34.1
^ permalink raw reply related [flat|nested] 38+ messages in thread* Re: [PATCH 07/10] soc: qcom: smp2p: Use __cleanup() for device_node pointers
2025-11-17 4:51 ` [PATCH 07/10] soc: qcom: smp2p: " Kathiravan Thirumoorthy
@ 2025-11-17 11:37 ` Konrad Dybcio
2025-11-18 11:41 ` Krzysztof Kozlowski
1 sibling, 0 replies; 38+ messages in thread
From: Konrad Dybcio @ 2025-11-17 11:37 UTC (permalink / raw)
To: Kathiravan Thirumoorthy, Bjorn Andersson, Konrad Dybcio
Cc: linux-arm-msm, linux-kernel
On 11/17/25 5:51 AM, Kathiravan Thirumoorthy wrote:
> Apply the __cleanup() attribute to device_node pointers to simplify
> resource management and remove explicit of_node_put() calls.
>
> Signed-off-by: Kathiravan Thirumoorthy <kathiravan.thirumoorthy@oss.qualcomm.com>
> ---
Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Konrad
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH 07/10] soc: qcom: smp2p: Use __cleanup() for device_node pointers
2025-11-17 4:51 ` [PATCH 07/10] soc: qcom: smp2p: " Kathiravan Thirumoorthy
2025-11-17 11:37 ` Konrad Dybcio
@ 2025-11-18 11:41 ` Krzysztof Kozlowski
1 sibling, 0 replies; 38+ messages in thread
From: Krzysztof Kozlowski @ 2025-11-18 11:41 UTC (permalink / raw)
To: Kathiravan Thirumoorthy, Bjorn Andersson, Konrad Dybcio
Cc: linux-arm-msm, linux-kernel
On 17/11/2025 05:51, Kathiravan Thirumoorthy wrote:
> Apply the __cleanup() attribute to device_node pointers to simplify
> resource management and remove explicit of_node_put() calls.
>
> Signed-off-by: Kathiravan Thirumoorthy <kathiravan.thirumoorthy@oss.qualcomm.com>
> ---
> drivers/soc/qcom/smp2p.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/soc/qcom/smp2p.c b/drivers/soc/qcom/smp2p.c
> index cb515c2340c107e92ece1bb8cd3854abf9f03e4a..2e22eb4728b7412685138fc86e55058b047bcb75 100644
> --- a/drivers/soc/qcom/smp2p.c
> +++ b/drivers/soc/qcom/smp2p.c
> @@ -501,7 +501,7 @@ static int qcom_smp2p_alloc_outbound_item(struct qcom_smp2p *smp2p)
>
> static int smp2p_parse_ipc(struct qcom_smp2p *smp2p)
> {
> - struct device_node *syscon;
> + struct device_node *syscon __free(device_node) = NULL;
NAK, stop with this pattern.
You are not simplifying anything here!
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 08/10] soc: qcom: smsm: Use __cleanup() for device_node pointers
2025-11-17 4:51 [PATCH 00/10] soc: qcom: Use __cleanup() for device_node pointers Kathiravan Thirumoorthy
` (6 preceding siblings ...)
2025-11-17 4:51 ` [PATCH 07/10] soc: qcom: smp2p: " Kathiravan Thirumoorthy
@ 2025-11-17 4:51 ` Kathiravan Thirumoorthy
2025-11-17 11:38 ` Konrad Dybcio
2025-11-18 11:42 ` Krzysztof Kozlowski
2025-11-17 4:51 ` [PATCH 09/10] soc: qcom: spm: " Kathiravan Thirumoorthy
2025-11-17 4:51 ` [PATCH 10/10] soc: qcom: ubwc: " Kathiravan Thirumoorthy
9 siblings, 2 replies; 38+ messages in thread
From: Kathiravan Thirumoorthy @ 2025-11-17 4:51 UTC (permalink / raw)
To: Bjorn Andersson, Konrad Dybcio
Cc: linux-arm-msm, linux-kernel, Kathiravan Thirumoorthy
Apply the __cleanup() attribute to device_node pointers to simplify
resource management and remove explicit of_node_put() calls.
Signed-off-by: Kathiravan Thirumoorthy <kathiravan.thirumoorthy@oss.qualcomm.com>
---
drivers/soc/qcom/smsm.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/drivers/soc/qcom/smsm.c b/drivers/soc/qcom/smsm.c
index 021e9d1f61dc5200514c5a239d52be97f7e82825..5600712f9185bba8c82da431cfb9f21f1bc44761 100644
--- a/drivers/soc/qcom/smsm.c
+++ b/drivers/soc/qcom/smsm.c
@@ -397,7 +397,7 @@ static int smsm_parse_mbox(struct qcom_smsm *smsm, unsigned int host_id)
*/
static int smsm_parse_ipc(struct qcom_smsm *smsm, unsigned host_id)
{
- struct device_node *syscon;
+ struct device_node *syscon __free(device_node) = NULL;
struct device_node *node = smsm->dev->of_node;
struct smsm_host *host = &smsm->hosts[host_id];
char key[16];
@@ -409,7 +409,6 @@ static int smsm_parse_ipc(struct qcom_smsm *smsm, unsigned host_id)
return 0;
host->ipc_regmap = syscon_node_to_regmap(syscon);
- of_node_put(syscon);
if (IS_ERR(host->ipc_regmap))
return PTR_ERR(host->ipc_regmap);
@@ -509,8 +508,8 @@ static int smsm_get_size_info(struct qcom_smsm *smsm)
static int qcom_smsm_probe(struct platform_device *pdev)
{
- struct device_node *local_node;
- struct device_node *node;
+ struct device_node *local_node __free(device_node) = NULL;
+ struct device_node *node __free(device_node) = NULL;
struct smsm_entry *entry;
struct qcom_smsm *smsm;
u32 *intr_mask;
@@ -640,12 +639,10 @@ static int qcom_smsm_probe(struct platform_device *pdev)
}
platform_set_drvdata(pdev, smsm);
- of_node_put(local_node);
return 0;
unwind_interfaces:
- of_node_put(node);
for (id = 0; id < smsm->num_entries; id++)
if (smsm->entries[id].domain)
irq_domain_remove(smsm->entries[id].domain);
@@ -655,7 +652,6 @@ static int qcom_smsm_probe(struct platform_device *pdev)
for (id = 0; id < smsm->num_hosts; id++)
mbox_free_channel(smsm->hosts[id].mbox_chan);
- of_node_put(local_node);
return ret;
}
--
2.34.1
^ permalink raw reply related [flat|nested] 38+ messages in thread* Re: [PATCH 08/10] soc: qcom: smsm: Use __cleanup() for device_node pointers
2025-11-17 4:51 ` [PATCH 08/10] soc: qcom: smsm: " Kathiravan Thirumoorthy
@ 2025-11-17 11:38 ` Konrad Dybcio
2025-11-18 11:42 ` Krzysztof Kozlowski
1 sibling, 0 replies; 38+ messages in thread
From: Konrad Dybcio @ 2025-11-17 11:38 UTC (permalink / raw)
To: Kathiravan Thirumoorthy, Bjorn Andersson, Konrad Dybcio
Cc: linux-arm-msm, linux-kernel
On 11/17/25 5:51 AM, Kathiravan Thirumoorthy wrote:
> Apply the __cleanup() attribute to device_node pointers to simplify
> resource management and remove explicit of_node_put() calls.
>
> Signed-off-by: Kathiravan Thirumoorthy <kathiravan.thirumoorthy@oss.qualcomm.com>
> ---
Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Konrad
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH 08/10] soc: qcom: smsm: Use __cleanup() for device_node pointers
2025-11-17 4:51 ` [PATCH 08/10] soc: qcom: smsm: " Kathiravan Thirumoorthy
2025-11-17 11:38 ` Konrad Dybcio
@ 2025-11-18 11:42 ` Krzysztof Kozlowski
1 sibling, 0 replies; 38+ messages in thread
From: Krzysztof Kozlowski @ 2025-11-18 11:42 UTC (permalink / raw)
To: Kathiravan Thirumoorthy, Bjorn Andersson, Konrad Dybcio
Cc: linux-arm-msm, linux-kernel
On 17/11/2025 05:51, Kathiravan Thirumoorthy wrote:
> Apply the __cleanup() attribute to device_node pointers to simplify
> resource management and remove explicit of_node_put() calls.
>
> Signed-off-by: Kathiravan Thirumoorthy <kathiravan.thirumoorthy@oss.qualcomm.com>
> ---
> drivers/soc/qcom/smsm.c | 10 +++-------
> 1 file changed, 3 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/soc/qcom/smsm.c b/drivers/soc/qcom/smsm.c
> index 021e9d1f61dc5200514c5a239d52be97f7e82825..5600712f9185bba8c82da431cfb9f21f1bc44761 100644
> --- a/drivers/soc/qcom/smsm.c
> +++ b/drivers/soc/qcom/smsm.c
> @@ -397,7 +397,7 @@ static int smsm_parse_mbox(struct qcom_smsm *smsm, unsigned int host_id)
> */
> static int smsm_parse_ipc(struct qcom_smsm *smsm, unsigned host_id)
> {
> - struct device_node *syscon;
> + struct device_node *syscon __free(device_node) = NULL;
NAK, stop with this pattern.
You are not simplifying anything here!
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 09/10] soc: qcom: spm: Use __cleanup() for device_node pointers
2025-11-17 4:51 [PATCH 00/10] soc: qcom: Use __cleanup() for device_node pointers Kathiravan Thirumoorthy
` (7 preceding siblings ...)
2025-11-17 4:51 ` [PATCH 08/10] soc: qcom: smsm: " Kathiravan Thirumoorthy
@ 2025-11-17 4:51 ` Kathiravan Thirumoorthy
2025-11-17 11:38 ` Konrad Dybcio
2025-11-18 11:42 ` Krzysztof Kozlowski
2025-11-17 4:51 ` [PATCH 10/10] soc: qcom: ubwc: " Kathiravan Thirumoorthy
9 siblings, 2 replies; 38+ messages in thread
From: Kathiravan Thirumoorthy @ 2025-11-17 4:51 UTC (permalink / raw)
To: Bjorn Andersson, Konrad Dybcio
Cc: linux-arm-msm, linux-kernel, Kathiravan Thirumoorthy
Apply the __cleanup() attribute to device_node pointers to simplify
resource management and remove explicit of_node_put() calls.
Signed-off-by: Kathiravan Thirumoorthy <kathiravan.thirumoorthy@oss.qualcomm.com>
---
drivers/soc/qcom/spm.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/soc/qcom/spm.c b/drivers/soc/qcom/spm.c
index f75659fff2874fb6a29c48ceee862b05b1ba5802..a87a8593a8b7fb2c62b14eaa9c96f46fc5eba877 100644
--- a/drivers/soc/qcom/spm.c
+++ b/drivers/soc/qcom/spm.c
@@ -391,7 +391,8 @@ static int spm_get_cpu(struct device *dev)
bool found;
for_each_possible_cpu(cpu) {
- struct device_node *cpu_node, *saw_node;
+ struct device_node *cpu_node __free(device_node) = NULL;
+ struct device_node *saw_node __free(device_node) = NULL;
cpu_node = of_cpu_device_node_get(cpu);
if (!cpu_node)
@@ -399,8 +400,6 @@ static int spm_get_cpu(struct device *dev)
saw_node = of_parse_phandle(cpu_node, "qcom,saw", 0);
found = (saw_node == dev->of_node);
- of_node_put(saw_node);
- of_node_put(cpu_node);
if (found)
return cpu;
--
2.34.1
^ permalink raw reply related [flat|nested] 38+ messages in thread* Re: [PATCH 09/10] soc: qcom: spm: Use __cleanup() for device_node pointers
2025-11-17 4:51 ` [PATCH 09/10] soc: qcom: spm: " Kathiravan Thirumoorthy
@ 2025-11-17 11:38 ` Konrad Dybcio
2025-11-18 11:42 ` Krzysztof Kozlowski
1 sibling, 0 replies; 38+ messages in thread
From: Konrad Dybcio @ 2025-11-17 11:38 UTC (permalink / raw)
To: Kathiravan Thirumoorthy, Bjorn Andersson, Konrad Dybcio
Cc: linux-arm-msm, linux-kernel
On 11/17/25 5:51 AM, Kathiravan Thirumoorthy wrote:
> Apply the __cleanup() attribute to device_node pointers to simplify
> resource management and remove explicit of_node_put() calls.
>
> Signed-off-by: Kathiravan Thirumoorthy <kathiravan.thirumoorthy@oss.qualcomm.com>
> ---
Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Konrad
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH 09/10] soc: qcom: spm: Use __cleanup() for device_node pointers
2025-11-17 4:51 ` [PATCH 09/10] soc: qcom: spm: " Kathiravan Thirumoorthy
2025-11-17 11:38 ` Konrad Dybcio
@ 2025-11-18 11:42 ` Krzysztof Kozlowski
1 sibling, 0 replies; 38+ messages in thread
From: Krzysztof Kozlowski @ 2025-11-18 11:42 UTC (permalink / raw)
To: Kathiravan Thirumoorthy, Bjorn Andersson, Konrad Dybcio
Cc: linux-arm-msm, linux-kernel
On 17/11/2025 05:51, Kathiravan Thirumoorthy wrote:
> Apply the __cleanup() attribute to device_node pointers to simplify
> resource management and remove explicit of_node_put() calls.
>
> Signed-off-by: Kathiravan Thirumoorthy <kathiravan.thirumoorthy@oss.qualcomm.com>
> ---
> drivers/soc/qcom/spm.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/soc/qcom/spm.c b/drivers/soc/qcom/spm.c
> index f75659fff2874fb6a29c48ceee862b05b1ba5802..a87a8593a8b7fb2c62b14eaa9c96f46fc5eba877 100644
> --- a/drivers/soc/qcom/spm.c
> +++ b/drivers/soc/qcom/spm.c
> @@ -391,7 +391,8 @@ static int spm_get_cpu(struct device *dev)
> bool found;
>
> for_each_possible_cpu(cpu) {
> - struct device_node *cpu_node, *saw_node;
> + struct device_node *cpu_node __free(device_node) = NULL;
> + struct device_node *saw_node __free(device_node) = NULL;
>
This is getting ridicilous. NAK, stop with this pattern.
You are not simplifying anything here!
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 10/10] soc: qcom: ubwc: Use __cleanup() for device_node pointers
2025-11-17 4:51 [PATCH 00/10] soc: qcom: Use __cleanup() for device_node pointers Kathiravan Thirumoorthy
` (8 preceding siblings ...)
2025-11-17 4:51 ` [PATCH 09/10] soc: qcom: spm: " Kathiravan Thirumoorthy
@ 2025-11-17 4:51 ` Kathiravan Thirumoorthy
2025-11-17 11:39 ` Konrad Dybcio
2025-11-18 11:43 ` Krzysztof Kozlowski
9 siblings, 2 replies; 38+ messages in thread
From: Kathiravan Thirumoorthy @ 2025-11-17 4:51 UTC (permalink / raw)
To: Bjorn Andersson, Konrad Dybcio
Cc: linux-arm-msm, linux-kernel, Kathiravan Thirumoorthy
Apply the __cleanup() attribute to device_node pointers to simplify
resource management and remove explicit of_node_put() calls.
Signed-off-by: Kathiravan Thirumoorthy <kathiravan.thirumoorthy@oss.qualcomm.com>
---
drivers/soc/qcom/ubwc_config.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/soc/qcom/ubwc_config.c b/drivers/soc/qcom/ubwc_config.c
index 1c09796163b09a19e387c18886966514cc19b209..1e7717aba5236050d8e736fb0891534b02203aae 100644
--- a/drivers/soc/qcom/ubwc_config.c
+++ b/drivers/soc/qcom/ubwc_config.c
@@ -301,15 +301,14 @@ static const struct of_device_id qcom_ubwc_configs[] __maybe_unused = {
const struct qcom_ubwc_cfg_data *qcom_ubwc_config_get_data(void)
{
+ struct device_node *root __free(device_node) = NULL;
const struct of_device_id *match;
- struct device_node *root;
root = of_find_node_by_path("/");
if (!root)
return ERR_PTR(-ENODEV);
match = of_match_node(qcom_ubwc_configs, root);
- of_node_put(root);
if (!match) {
pr_err("Couldn't find UBWC config data for this platform!\n");
return ERR_PTR(-EINVAL);
--
2.34.1
^ permalink raw reply related [flat|nested] 38+ messages in thread* Re: [PATCH 10/10] soc: qcom: ubwc: Use __cleanup() for device_node pointers
2025-11-17 4:51 ` [PATCH 10/10] soc: qcom: ubwc: " Kathiravan Thirumoorthy
@ 2025-11-17 11:39 ` Konrad Dybcio
2025-11-18 11:43 ` Krzysztof Kozlowski
1 sibling, 0 replies; 38+ messages in thread
From: Konrad Dybcio @ 2025-11-17 11:39 UTC (permalink / raw)
To: Kathiravan Thirumoorthy, Bjorn Andersson, Konrad Dybcio
Cc: linux-arm-msm, linux-kernel
On 11/17/25 5:51 AM, Kathiravan Thirumoorthy wrote:
> Apply the __cleanup() attribute to device_node pointers to simplify
> resource management and remove explicit of_node_put() calls.
>
> Signed-off-by: Kathiravan Thirumoorthy <kathiravan.thirumoorthy@oss.qualcomm.com>
> ---
Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Konrad
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH 10/10] soc: qcom: ubwc: Use __cleanup() for device_node pointers
2025-11-17 4:51 ` [PATCH 10/10] soc: qcom: ubwc: " Kathiravan Thirumoorthy
2025-11-17 11:39 ` Konrad Dybcio
@ 2025-11-18 11:43 ` Krzysztof Kozlowski
1 sibling, 0 replies; 38+ messages in thread
From: Krzysztof Kozlowski @ 2025-11-18 11:43 UTC (permalink / raw)
To: Kathiravan Thirumoorthy, Bjorn Andersson, Konrad Dybcio
Cc: linux-arm-msm, linux-kernel
On 17/11/2025 05:51, Kathiravan Thirumoorthy wrote:
> Apply the __cleanup() attribute to device_node pointers to simplify
> resource management and remove explicit of_node_put() calls.
>
> Signed-off-by: Kathiravan Thirumoorthy <kathiravan.thirumoorthy@oss.qualcomm.com>
> ---
> drivers/soc/qcom/ubwc_config.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/soc/qcom/ubwc_config.c b/drivers/soc/qcom/ubwc_config.c
> index 1c09796163b09a19e387c18886966514cc19b209..1e7717aba5236050d8e736fb0891534b02203aae 100644
> --- a/drivers/soc/qcom/ubwc_config.c
> +++ b/drivers/soc/qcom/ubwc_config.c
> @@ -301,15 +301,14 @@ static const struct of_device_id qcom_ubwc_configs[] __maybe_unused = {
>
> const struct qcom_ubwc_cfg_data *qcom_ubwc_config_get_data(void)
> {
> + struct device_node *root __free(device_node) = NULL;
> const struct of_device_id *match;
You are writing worse code than it was before. The code was like that
intentionally.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 38+ messages in thread