diff options
author | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2023-02-07 20:19:06 +0100 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2023-02-08 13:39:12 +0100 |
commit | 73c5685c431a090152cbc9e45857feb207f0032f (patch) | |
tree | ffd36921e758c12e44a2b34514120e99189087aa /sound/core | |
parent | ALSA: core: Make snd_card_disconnect() return void (diff) | |
download | linux-73c5685c431a090152cbc9e45857feb207f0032f.tar.xz linux-73c5685c431a090152cbc9e45857feb207f0032f.zip |
ALSA: core: Make snd_card_free_when_closed() return void
All callers from other files ignore the return value of this function.
And it can only ever return a non-zero value if the parameter card is NULL.
This cannot happen in snd_card_free() as card was dereferenced just before
snd_card_free_when_closed() is called. So the error handling can be dropped
there.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Acked-by: Geoff Levand <geoff@infradead.org>
Acked-by: Thierry Reding <treding@nvidia.com>
Link: https://lore.kernel.org/r/20230207191907.467756-3-u.kleine-koenig@pengutronix.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core')
-rw-r--r-- | sound/core/init.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/sound/core/init.c b/sound/core/init.c index a03eddab12fe..6bb3e2b77971 100644 --- a/sound/core/init.c +++ b/sound/core/init.c @@ -608,14 +608,14 @@ static int snd_card_do_free(struct snd_card *card) * * Return: zero if successful, or a negative error code */ -int snd_card_free_when_closed(struct snd_card *card) +void snd_card_free_when_closed(struct snd_card *card) { if (!card) - return -EINVAL; + return; snd_card_disconnect(card); put_device(&card->card_dev); - return 0; + return; } EXPORT_SYMBOL(snd_card_free_when_closed); @@ -635,7 +635,6 @@ EXPORT_SYMBOL(snd_card_free_when_closed); int snd_card_free(struct snd_card *card) { DECLARE_COMPLETION_ONSTACK(released); - int ret; /* The call of snd_card_free() is allowed from various code paths; * a manual call from the driver and the call via devres_free, and @@ -647,9 +646,8 @@ int snd_card_free(struct snd_card *card) return 0; card->release_completion = &released; - ret = snd_card_free_when_closed(card); - if (ret) - return ret; + snd_card_free_when_closed(card); + /* wait, until all devices are ready for the free operation */ wait_for_completion(&released); |