From: "Arnd Bergmann" <arnd@arndb.de>
To: "Peter Ujfalusi" <peter.ujfalusi@linux.intel.com>,
tiwai@suse.com, "Jaroslav Kysela" <perex@perex.cz>
Cc: "Masahiro Yamada" <masahiroy@kernel.org>,
linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org
Subject: Re: [PATCH] ALSA: core: Increase the name array size for debugfs directory name
Date: Tue, 12 Sep 2023 12:18:04 +0200 [thread overview]
Message-ID: <96c5309d-bb06-486e-a1f8-e3d71b275f13@app.fastmail.com> (raw)
In-Reply-To: <20230912083910.15994-1-peter.ujfalusi@linux.intel.com>
On Tue, Sep 12, 2023, at 10:39, Peter Ujfalusi wrote:
> While the code is correct, we need to silence the compiler somehow.
> It could be done by limiting the range in sprintf like
> sprintf(name, "card%d", idx % SNDRV_CARDS);
> sprintf(name, "card%hhd", idx);
> etc
>
> These are too workaroundish. Increase the name array to 15 instead which
> looks better and only adds 7 bytes on stack.
It looks like we use the same string for kobject_set_name(), so
maybe this would work as well:
--- a/sound/core/init.c
+++ b/sound/core/init.c
@@ -278,9 +278,6 @@ static int snd_card_init(struct snd_card *card, struct device *parent,
size_t extra_size)
{
int err;
-#ifdef CONFIG_SND_DEBUG
- char name[8];
-#endif
if (extra_size > 0)
card->private_data = (char *)card + sizeof(struct snd_card);
@@ -364,8 +361,8 @@ static int snd_card_init(struct snd_card *card, struct device *parent,
}
#ifdef CONFIG_SND_DEBUG
- sprintf(name, "card%d", idx);
- card->debugfs_root = debugfs_create_dir(name, sound_debugfs_root);
+ card->debugfs_root = debugfs_create_dir(kobject_name(&card->card_dev.kobj),
+ sound_debugfs_root);
#endif
return 0;
Arnd
next prev parent reply other threads:[~2023-09-12 10:20 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-12 8:39 [PATCH] ALSA: core: Increase the name array size for debugfs directory name Peter Ujfalusi
2023-09-12 10:18 ` Arnd Bergmann [this message]
2023-09-12 10:42 ` Takashi Iwai
2023-09-12 10:58 ` Péter Ujfalusi
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=96c5309d-bb06-486e-a1f8-e3d71b275f13@app.fastmail.com \
--to=arnd@arndb.de \
--cc=alsa-devel@alsa-project.org \
--cc=linux-kernel@vger.kernel.org \
--cc=masahiroy@kernel.org \
--cc=perex@perex.cz \
--cc=peter.ujfalusi@linux.intel.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