Skip to content

Commit 9e6febe

Browse files
elfringtiwai
authored andcommitted
ALSA: sh: Use more common error handling code in snd_aica_probe()
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> Link: https://patch.msgid.link/47413de1-015b-4543-8e8c-25e41dfa9e39@web.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent 8956950 commit 9e6febe

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

sound/sh/aica.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -564,10 +564,9 @@ static int snd_aica_probe(struct platform_device *devptr)
564564
return -ENOMEM;
565565
err = snd_card_new(&devptr->dev, index, SND_AICA_DRIVER,
566566
THIS_MODULE, 0, &dreamcastcard->card);
567-
if (unlikely(err < 0)) {
568-
kfree(dreamcastcard);
569-
return err;
570-
}
567+
if (unlikely(err < 0))
568+
goto free_card;
569+
571570
strscpy(dreamcastcard->card->driver, "snd_aica");
572571
strscpy(dreamcastcard->card->shortname, SND_AICA_DRIVER);
573572
strscpy(dreamcastcard->card->longname,
@@ -593,6 +592,7 @@ static int snd_aica_probe(struct platform_device *devptr)
593592
return 0;
594593
freedreamcast:
595594
snd_card_free(dreamcastcard->card);
595+
free_card:
596596
kfree(dreamcastcard);
597597
return err;
598598
}

0 commit comments

Comments
 (0)