mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Richard Fitzgerald <rf@opensource.cirrus.com>
To: <Claudiu.Beznea@microchip.com>, <tiwai@suse.com>,
	<broonie@kernel.org>, <perex@perex.cz>
Cc: <alsa-devel@alsa-project.org>, <linux-kernel@vger.kernel.org>,
	<patches@opensource.cirrus.com>, <simont@opensource.cirrus.com>
Subject: Re: [PATCH v3 12/12] ALSA: hda/cs35l56: Add driver for Cirrus Logic CS35L56 amplifier
Date: Tue, 30 May 2023 10:34:11 +0100	[thread overview]
Message-ID: <e64614db-8633-55ad-f5db-68ef8a371dfa@opensource.cirrus.com> (raw)
In-Reply-To: <4ec68c42-dbab-5006-c6a5-0be147a7d0f1@microchip.com>

On 30/05/2023 08:39, Claudiu.Beznea@microchip.com wrote:
> On 26.05.2023 15:28, Richard Fitzgerald wrote:
>> +static int cs35l56_hda_request_firmware_file(struct cs35l56_hda *cs35l56,
>> +                                            const struct firmware **firmware, char **filename,
>> +                                            const char *dir, const char *system_name,
>> +                                            const char *amp_name,
>> +                                            const char *filetype)
>> +{
>> +       char *s, c;
>> +       int ret = 0;
>> +
>> +       if (system_name && amp_name)
>> +               *filename = kasprintf(GFP_KERNEL, "%scs35l56%s-%02x-dsp1-misc-%s-%s.%s", dir,
>> +                                     cs35l56->base.secured ? "s" : "", cs35l56->base.rev,
>> +                                     system_name, amp_name, filetype);
>> +       else if (system_name)
>> +               *filename = kasprintf(GFP_KERNEL, "%scs35l56%s-%02x-dsp1-misc-%s.%s", dir,
>> +                                     cs35l56->base.secured ? "s" : "", cs35l56->base.rev,
>> +                                     system_name, filetype);
>> +       else
>> +               *filename = kasprintf(GFP_KERNEL, "%scs35l56%s-%02x-dsp1-misc.%s", dir,
>> +                                     cs35l56->base.secured ? "s" : "", cs35l56->base.rev,
>> +                                     filetype);
>> +
>> +       if (!*filename)
>> +               return -ENOMEM;
>> +
>> +       /*
>> +        * Make sure that filename is lower-case and any non alpha-numeric
>> +        * characters except full stop and forward slash are replaced with
>> +        * hyphens.
>> +        */
>> +       s = *filename;
>> +       while (*s) {
>> +               c = *s;
>> +               if (isalnum(c))
>> +                       *s = tolower(c);
>> +               else if (c != '.' && c != '/')
>> +                       *s = '-';
>> +               s++;
>> +       }
>> +
>> +       ret = firmware_request_nowarn(firmware, *filename, cs35l56->base.dev);
>> +       if (ret) {
>> +               dev_dbg(cs35l56->base.dev, "Failed to request '%s'\n", *filename);
>> +               kfree(*filename);
>> +               *filename = NULL;
>> +       } else {
>> +               dev_dbg(cs35l56->base.dev, "Found '%s'\n", *filename);
> 
> I may be wrong but *filename seems leaked to me on this path. I noticed it
> is could be duplicated on cs_dsp_debugfs_save_wmfwname() but the original
> copy seems left aside.
> 

It's not a leak. The file has been found so the name of the found
file is returned (it's used by other code). But there is a leak of that
memory elsewhere.

>> +       }
>> +
>> +       return ret;
>> +}
> 

      reply	other threads:[~2023-05-30  9:35 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-26 12:28 [PATCH v3 00/12] ALSA: hda: Adding support for CS35L56 on HDA systems Richard Fitzgerald
2023-05-26 12:28 ` [PATCH v3 01/12] ASoC: cs35l56: Move shared data into a common data structure Richard Fitzgerald
2023-05-26 12:28 ` [PATCH v3 02/12] ASoC: cs35l56: Make cs35l56_system_reset() code more generic Richard Fitzgerald
2023-05-26 12:28 ` [PATCH v3 03/12] ASoC: cs35l56: Convert utility functions to use common data structure Richard Fitzgerald
2023-05-26 12:28 ` [PATCH v3 04/12] ASoC: cs35l56: Move utility functions to shared file Richard Fitzgerald
2023-05-26 12:28 ` [PATCH v3 05/12] ASoC: cs35l56: Move runtime suspend/resume to shared library Richard Fitzgerald
2023-05-26 12:28 ` [PATCH v3 06/12] ASoC: cs35l56: Move cs_dsp init into " Richard Fitzgerald
2023-05-26 12:28 ` [PATCH v3 07/12] ASoC: cs35l56: Move part of cs35l56_init() to " Richard Fitzgerald
2023-05-26 12:28 ` [PATCH v3 08/12] ASoC: cs35l56: Make common function for control port wait Richard Fitzgerald
2023-05-26 12:28 ` [PATCH v3 09/12] ASoC: cs35l56: Make a common function to shutdown the DSP Richard Fitzgerald
2023-05-26 12:28 ` [PATCH v3 10/12] ALSA: hda: Fix missing header dependencies Richard Fitzgerald
2023-05-26 12:28 ` [PATCH v3 11/12] ALSA: hda: Add mute_hook to hda_component Richard Fitzgerald
2023-05-26 12:28 ` [PATCH v3 12/12] ALSA: hda/cs35l56: Add driver for Cirrus Logic CS35L56 amplifier Richard Fitzgerald
2023-05-30  7:39   ` Claudiu.Beznea
2023-05-30  9:34     ` Richard Fitzgerald [this message]

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=e64614db-8633-55ad-f5db-68ef8a371dfa@opensource.cirrus.com \
    --to=rf@opensource.cirrus.com \
    --cc=Claudiu.Beznea@microchip.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=patches@opensource.cirrus.com \
    --cc=perex@perex.cz \
    --cc=simont@opensource.cirrus.com \
    --cc=tiwai@suse.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®