From: Markus Elfring <Markus.Elfring@web.de>
To: linux-sound@vger.kernel.org, Jaroslav Kysela <perex@perex.cz>,
Kees Cook <kees@kernel.org>, Takashi Iwai <tiwai@suse.com>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: [PATCH] ALSA: sh: Use more common error handling code in snd_aica_probe()
Date: Wed, 17 Jun 2026 08:52:53 +0200 [thread overview]
Message-ID: <47413de1-015b-4543-8e8c-25e41dfa9e39@web.de> (raw)
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 17 Jun 2026 08:42:18 +0200
Use an additional label so that a bit of exception handling can be better
reused at the end of this function implementation.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
sound/sh/aica.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/sound/sh/aica.c b/sound/sh/aica.c
index 9438c3a68ee9..8196e1bf0416 100644
--- a/sound/sh/aica.c
+++ b/sound/sh/aica.c
@@ -564,10 +564,9 @@ static int snd_aica_probe(struct platform_device *devptr)
return -ENOMEM;
err = snd_card_new(&devptr->dev, index, SND_AICA_DRIVER,
THIS_MODULE, 0, &dreamcastcard->card);
- if (unlikely(err < 0)) {
- kfree(dreamcastcard);
- return err;
- }
+ if (unlikely(err < 0))
+ goto free_card;
+
strscpy(dreamcastcard->card->driver, "snd_aica");
strscpy(dreamcastcard->card->shortname, SND_AICA_DRIVER);
strscpy(dreamcastcard->card->longname,
@@ -593,6 +592,7 @@ static int snd_aica_probe(struct platform_device *devptr)
return 0;
freedreamcast:
snd_card_free(dreamcastcard->card);
+free_card:
kfree(dreamcastcard);
return err;
}
--
2.54.0
next reply other threads:[~2026-06-17 6:58 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-17 6:52 Markus Elfring [this message]
2026-06-17 9:06 ` Takashi Iwai
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=47413de1-015b-4543-8e8c-25e41dfa9e39@web.de \
--to=markus.elfring@web.de \
--cc=kees@kernel.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=perex@perex.cz \
--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®