Linux Sound subsystem development
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzk@kernel.org>
To: Richard Fitzgerald <rf@opensource.cirrus.com>, broonie@kernel.org
Cc: linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org,
	patches@opensource.cirrus.com
Subject: Re: [PATCH] ASoC: cs-amp-lib: Use __free(kfree) instead of manual freeing
Date: Sat, 29 Nov 2025 15:28:26 +0100	[thread overview]
Message-ID: <8f889b72-479c-46fb-a8cf-c9abfc491463@kernel.org> (raw)
In-Reply-To: <20251127155817.1374079-1-rf@opensource.cirrus.com>

On 27/11/2025 16:58, Richard Fitzgerald wrote:
> Use the __free(kfree) cleanup to replace instances of manually
> calling kfree(). Also make some code path simplifications that this
> allows.
> 
> Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
> ---
>  sound/soc/codecs/cs-amp-lib.c | 29 ++++++++++++-----------------
>  1 file changed, 12 insertions(+), 17 deletions(-)
> 
> diff --git a/sound/soc/codecs/cs-amp-lib.c b/sound/soc/codecs/cs-amp-lib.c
> index d8f8b0259cd1..8c9fd9980a7d 100644
> --- a/sound/soc/codecs/cs-amp-lib.c
> +++ b/sound/soc/codecs/cs-amp-lib.c
> @@ -7,6 +7,7 @@
>  
>  #include <asm/byteorder.h>
>  #include <kunit/static_stub.h>
> +#include <linux/cleanup.h>
>  #include <linux/debugfs.h>
>  #include <linux/dev_printk.h>
>  #include <linux/efi.h>
> @@ -309,9 +310,8 @@ static struct cirrus_amp_efi_data *cs_amp_get_cal_efi_buffer(struct device *dev,
>  							     efi_guid_t **guid,
>  							     u32 *attr)
>  {
> -	struct cirrus_amp_efi_data *efi_data;
> +	struct cirrus_amp_efi_data *efi_data __free(kfree) = NULL;

This is an undesired syntax explicitly documented as one to avoid. You
need here proper assignment, not NULL. Please don't use cleanup.h if you
do not intend to follow it because it does not make the code simpler.


Best regards,
Krzysztof

  parent reply	other threads:[~2025-11-29 14:28 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-27 15:58 [PATCH] ASoC: cs-amp-lib: Use __free(kfree) instead of manual freeing Richard Fitzgerald
2025-11-27 21:52 ` Mark Brown
2025-11-29 14:28 ` Krzysztof Kozlowski [this message]
2025-12-01  9:57   ` Richard Fitzgerald
2025-12-01 11:30     ` Richard Fitzgerald
2025-12-01 11:40       ` Krzysztof Kozlowski

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=8f889b72-479c-46fb-a8cf-c9abfc491463@kernel.org \
    --to=krzk@kernel.org \
    --cc=broonie@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=patches@opensource.cirrus.com \
    --cc=rf@opensource.cirrus.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