mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Gatien CHEVALLIER <gatien.chevallier@foss.st.com>
To: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>,
	"Bjorn Andersson" <andersson@kernel.org>,
	Konrad Dybcio <konradybcio@kernel.org>,
	Maxime Coquelin <mcoquelin.stm32@gmail.com>,
	Alexandre Torgue <alexandre.torgue@foss.st.com>,
	<linux-arm-msm@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<linux-stm32@st-md-mailman.stormreply.com>,
	<linux-arm-kernel@lists.infradead.org>
Cc: Jonathan Cameron <jonathan.cameron@huawei.com>
Subject: Re: [PATCH v2 3/3] bus: stm32_firewall: Use scoped allocation to simplify cleanup
Date: Fri, 9 Jan 2026 13:34:29 +0100	[thread overview]
Message-ID: <cd8fc344-37a0-4281-b3c0-29514b97f5f3@foss.st.com> (raw)
In-Reply-To: <ccebe9a6-34e7-4699-a4ff-1ee925f9c150@oss.qualcomm.com>



On 1/9/26 12:55, Krzysztof Kozlowski wrote:
> On 09/01/2026 11:37, Gatien CHEVALLIER wrote:
>> On 1/5/26 15:37, Krzysztof Kozlowski wrote:
>>> Allocate the memory with scoped/cleanup.h to reduce error handling and
>>> make the code a bit simpler.
>>>
>>> Suggested-by: Jonathan Cameron <jonathan.cameron@huawei.com>
>>> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
>>>
>>> ---
>>>
>>> Changes in v2:
>>> 1. New patch
>>> ---
>>>    drivers/bus/stm32_firewall.c | 10 +++-------
>>>    1 file changed, 3 insertions(+), 7 deletions(-)
>>>
>>> diff --git a/drivers/bus/stm32_firewall.c b/drivers/bus/stm32_firewall.c
>>> index fae881cea9a0..92414a4c7bb1 100644
>>> --- a/drivers/bus/stm32_firewall.c
>>> +++ b/drivers/bus/stm32_firewall.c
>>> @@ -240,7 +240,6 @@ EXPORT_SYMBOL_GPL(stm32_firewall_controller_unregister);
>>>    
>>>    int stm32_firewall_populate_bus(struct stm32_firewall_controller *firewall_controller)
>>>    {
>>> -	struct stm32_firewall *firewalls;
>>>    	struct device *parent;
>>>    	unsigned int i;
>>>    	int len;
>>> @@ -257,15 +256,14 @@ int stm32_firewall_populate_bus(struct stm32_firewall_controller *firewall_contr
>>>    		if (len <= 0)
>>>    			return -EINVAL;
>>>    
>>> -		firewalls = kcalloc(len, sizeof(*firewalls), GFP_KERNEL);
>>> +		struct stm32_firewall *firewalls __free(kfree) =
>>> +			kcalloc(len, sizeof(*firewalls), GFP_KERNEL);
>>
>> Hello,
>>
>> I'd prefer to keep declarations separated.
> 
> Separated how? This is the coding style of cleanup (which is quite
> explicit around other styles)? Or you meant one line without wrapping?
> 

I found odd to declare and assign a variable mid-loop but I found
multiple occurrences of the same kind of cleanup.

You can drop my comment, I'm fine with how it is. Thanks for the
cleanup.

>>
>> Otherwise:
>>
>> Tested-by: Gatien Chevallier <gatien.chevallier@foss.st.com>
>>
> 
> 
> 
> Best regards,
> Krzysztof


  reply	other threads:[~2026-01-09 12:34 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-05 14:36 [PATCH v2 1/3] bus: qcom-ebi2: Simplify with scoped for each OF child loop Krzysztof Kozlowski
2026-01-05 14:36 ` [PATCH v2 2/3] bus: stm32_firewall: " Krzysztof Kozlowski
2026-01-09 10:33   ` Gatien CHEVALLIER
2026-01-05 14:37 ` [PATCH v2 3/3] bus: stm32_firewall: Use scoped allocation to simplify cleanup Krzysztof Kozlowski
2026-01-09 10:37   ` Gatien CHEVALLIER
2026-01-09 11:55     ` Krzysztof Kozlowski
2026-01-09 12:34       ` Gatien CHEVALLIER [this message]
2026-01-09 15:20         ` Krzysztof Kozlowski
2026-03-01 14:12   ` Krzysztof Kozlowski
2026-03-02  8:15     ` Alexandre TORGUE
2026-03-10  9:04     ` Alexandre TORGUE
2026-01-05 14:38 ` [PATCH v2 1/3] bus: qcom-ebi2: Simplify with scoped for each OF child loop Krzysztof Kozlowski
2026-01-06 17:52 ` (subset) " Bjorn Andersson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cd8fc344-37a0-4281-b3c0-29514b97f5f3@foss.st.com \
    --to=gatien.chevallier@foss.st.com \
    --cc=alexandre.torgue@foss.st.com \
    --cc=andersson@kernel.org \
    --cc=jonathan.cameron@huawei.com \
    --cc=konradybcio@kernel.org \
    --cc=krzysztof.kozlowski@oss.qualcomm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=mcoquelin.stm32@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®