From patchwork Tue Feb 7 19:19:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 13132230 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 905F8C636CD for ; Tue, 7 Feb 2023 23:54:06 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 457CA83B; Wed, 8 Feb 2023 00:53:14 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 457CA83B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1675814044; bh=JrtvmnG60IpCa3g342NWkBGfpziD8Runnsf6I+fRevc=; h=From:To:Subject:Date:In-Reply-To:References:CC:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=c3J9Tr4VjkPjJh6XYL2mAr/KwTIkOwIPoJA9uumVGqEDGc1hyzPc2Cwa6S84LfOI0 QrLRcrQjymQ7U44CUqfLO05yBkfj9QBAaulHi3dxOBuzhRz0YL2FAA5OGlxeRYQLOx w4gny+hNgREGZV4Qrp35A1AcKr7iHRfg0ftwJzww= Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 51E3FF80525; Wed, 8 Feb 2023 00:52:19 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 94D5BF80152; Wed, 8 Feb 2023 00:52:13 +0100 (CET) Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id CCF3FF800E2 for ; Wed, 8 Feb 2023 00:52:02 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz CCF3FF800E2 Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pPTVA-0008RP-8U; Tue, 07 Feb 2023 20:19:36 +0100 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.94.2) (envelope-from ) id 1pPTV8-003LvB-1M; Tue, 07 Feb 2023 20:19:35 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1pPTV8-001ew8-Hn; Tue, 07 Feb 2023 20:19:34 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Jaroslav Kysela , Takashi Iwai Subject: [PATCH 1/3] ALSA: core: Make snd_card_disconnect() return void Date: Tue, 7 Feb 2023 20:19:05 +0100 Message-Id: <20230207191907.467756-2-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230207191907.467756-1-u.kleine-koenig@pengutronix.de> References: <20230207191907.467756-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2965; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=JrtvmnG60IpCa3g342NWkBGfpziD8Runnsf6I+fRevc=; b=owEBbQGS/pANAwAKAcH8FHityuwJAcsmYgBj4qQfxFXQV937j3r5E264qu6mQ2U2tSeFZ2eFwWDD Wa2F5uKJATMEAAEKAB0WIQR+cioWkBis/z50pAvB/BR4rcrsCQUCY+KkHwAKCRDB/BR4rcrsCXkEB/ 4jwn7HLhxvidRm8WkltlHnGLE7Z+kvM9vmCc5A/rgRs8xY2VfmtkT9fJFZe0II5AKPlhLDPplscXFH LIzb2r+OoNdujn2ZEaagWe8IiHxb3j4E2GueTG0q/24FvJerwASVgZhTwF3w7pcuEYcFK2ksISJgKC 3trm4Vs9N63yrBNBfmaVgRkFTfT6jW2CkbCcRd8D7IX3LsvmHdq/pmy6g+SVu/4/CV0k8XYJ1F2SBp LsbXcKkvGSvSlic83cxLtBPL+eXSr3HJOqZz7hv8/E9QkQB8gMwRbNN6rtezSV7X8rKRG0AFuNRuYC ehhvAFExsIwL7rjYbLuIgNhxc/O2VM X-Developer-Key: i=u.kleine-koenig@pengutronix.de; a=openpgp; fpr=0D2511F322BFAB1C1580266BE2DCDD9132669BD6 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: alsa-devel@alsa-project.org Message-ID-Hash: M3BZOE3I7IYDQSRJJSIRWNT2SQYVE4UQ X-Message-ID-Hash: M3BZOE3I7IYDQSRJJSIRWNT2SQYVE4UQ X-MailFrom: ukl@pengutronix.de X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: alsa-devel@alsa-project.org, kernel@pengutronix.de X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: 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. Move the check for card being NULL into snd_card_free_when_closed() to keep the previous behaviour. Note this isn't necessary for snd_card_disconnect_sync() because if card was NULL in there the dereference of card for dev_err() would oops the kernel. Replace this by an oops triggered by the dereference of card for spin_lock_irq(). Signed-off-by: Uwe Kleine-König --- include/sound/core.h | 2 +- sound/core/init.c | 24 ++++++++---------------- 2 files changed, 9 insertions(+), 17 deletions(-) diff --git a/include/sound/core.h b/include/sound/core.h index 4365c35d038b..9a73c60b6f1e 100644 --- a/include/sound/core.h +++ b/include/sound/core.h @@ -286,7 +286,7 @@ int snd_devm_card_new(struct device *parent, int idx, const char *xid, struct module *module, size_t extra_size, struct snd_card **card_ret); -int snd_card_disconnect(struct snd_card *card); +void snd_card_disconnect(struct snd_card *card); void snd_card_disconnect_sync(struct snd_card *card); int snd_card_free(struct snd_card *card); int snd_card_free_when_closed(struct snd_card *card); diff --git a/sound/core/init.c b/sound/core/init.c index 5377f94eb211..a03eddab12fe 100644 --- a/sound/core/init.c +++ b/sound/core/init.c @@ -489,17 +489,17 @@ static const struct file_operations snd_shutdown_f_ops = * Note: The current implementation replaces all active file->f_op with special * dummy file operations (they do nothing except release). */ -int snd_card_disconnect(struct snd_card *card) +void snd_card_disconnect(struct snd_card *card) { struct snd_monitor_file *mfile; if (!card) - return -EINVAL; + return; spin_lock(&card->files_lock); if (card->shutdown) { spin_unlock(&card->files_lock); - return 0; + return; } card->shutdown = 1; @@ -548,7 +548,6 @@ int snd_card_disconnect(struct snd_card *card) wake_up(&card->power_sleep); snd_power_sync_ref(card); #endif - return 0; } EXPORT_SYMBOL(snd_card_disconnect); @@ -563,15 +562,7 @@ EXPORT_SYMBOL(snd_card_disconnect); */ void snd_card_disconnect_sync(struct snd_card *card) { - int err; - - err = snd_card_disconnect(card); - if (err < 0) { - dev_err(card->dev, - "snd_card_disconnect error (%d), skipping sync\n", - err); - return; - } + snd_card_disconnect(card); spin_lock_irq(&card->files_lock); wait_event_lock_irq(card->remove_sleep, @@ -619,9 +610,10 @@ static int snd_card_do_free(struct snd_card *card) */ int snd_card_free_when_closed(struct snd_card *card) { - int ret = snd_card_disconnect(card); - if (ret) - return ret; + if (!card) + return -EINVAL; + + snd_card_disconnect(card); put_device(&card->card_dev); return 0; } From patchwork Tue Feb 7 19:19:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 13132227 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8459DC636CC for ; Tue, 7 Feb 2023 23:53:33 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id C14B73E8; Wed, 8 Feb 2023 00:52:40 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz C14B73E8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1675814010; bh=QndZ7tYlfmaqsT9TpWtutfsir/wk+cDucaDxJbdN7W8=; h=From:To:Subject:Date:In-Reply-To:References:CC:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=RBvKfhivSLAY72DtGfIcGW/riefe/1I8tvKuffpUjz4jnCvlawVv9sCnJV9XM2TTa KfqWKfTgHoX4FIuqAj4fcmFBGICgUn70LXfHOSJvcdPy1VL0hEkDxB6a/ho4TUx+Sf DUWbg+DG6FtXpQrlUZz5AMJwjovxj//8rsDQ+Mu8= Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 93E4AF80095; Wed, 8 Feb 2023 00:52:14 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 4C8DCF80152; Wed, 8 Feb 2023 00:52:10 +0100 (CET) Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 19AFCF80095 for ; Wed, 8 Feb 2023 00:52:08 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 19AFCF80095 Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pPTVA-0008RQ-8V; Tue, 07 Feb 2023 20:19:36 +0100 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.94.2) (envelope-from ) id 1pPTV8-003LvE-6l; Tue, 07 Feb 2023 20:19:35 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1pPTV8-001ewC-RR; Tue, 07 Feb 2023 20:19:34 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Jaroslav Kysela , Takashi Iwai Subject: [PATCH 2/3] ALSA: core: Make snd_card_free_when_closed() return void Date: Tue, 7 Feb 2023 20:19:06 +0100 Message-Id: <20230207191907.467756-3-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230207191907.467756-1-u.kleine-koenig@pengutronix.de> References: <20230207191907.467756-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2431; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=QndZ7tYlfmaqsT9TpWtutfsir/wk+cDucaDxJbdN7W8=; b=owEBbQGS/pANAwAKAcH8FHityuwJAcsmYgBj4qQihqS+RqvE4mHTbtFK25t/9HPpCE7QvpjDFs9f Hx8KRTOJATMEAAEKAB0WIQR+cioWkBis/z50pAvB/BR4rcrsCQUCY+KkIgAKCRDB/BR4rcrsCYi3CA CCKHI+lrkoXLA2CbSJ4SFg/vgq1RZVLHyKNc4YX2LyU7Qf9H0mX8HERUduG/VCS3nbG5qB45/bI9nO IcDmLzI3Xe4Bh/KMc/g1vvgqp33/7q/v/RXmxId8sw8lOUL1Ct7Jb3klyLFaHSo/5s4PVcaXAjv43g F6ABuS5BV/uMFZSWb1enx7G493u19CHnq8oBd+kcIZQiptjTjKkqwCPf7h+8mCl0pZxMOd6OgTsCqM sLByoQuXA9E0MTe+LnMYVzoP0CYA+Y8PQal+QelNdGvywmJ4cWkLUxg3U51CbUWXv/9WpmA2REQ3IA 0SGOyWIit5AWISkBwJ2KqIPsEfr97u X-Developer-Key: i=u.kleine-koenig@pengutronix.de; a=openpgp; fpr=0D2511F322BFAB1C1580266BE2DCDD9132669BD6 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: alsa-devel@alsa-project.org Message-ID-Hash: I3T5GFJWB56XANDBL7FSSQTLRHA5IXMI X-Message-ID-Hash: I3T5GFJWB56XANDBL7FSSQTLRHA5IXMI X-MailFrom: ukl@pengutronix.de X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: alsa-devel@alsa-project.org, kernel@pengutronix.de X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: 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 --- include/sound/core.h | 2 +- sound/core/init.c | 12 +++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/include/sound/core.h b/include/sound/core.h index 9a73c60b6f1e..21884c979c17 100644 --- a/include/sound/core.h +++ b/include/sound/core.h @@ -289,7 +289,7 @@ int snd_devm_card_new(struct device *parent, int idx, const char *xid, void snd_card_disconnect(struct snd_card *card); void snd_card_disconnect_sync(struct snd_card *card); int snd_card_free(struct snd_card *card); -int snd_card_free_when_closed(struct snd_card *card); +void snd_card_free_when_closed(struct snd_card *card); int snd_card_free_on_error(struct device *dev, int ret); void snd_card_set_id(struct snd_card *card, const char *id); int snd_card_register(struct snd_card *card); 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); From patchwork Tue Feb 7 19:19:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 13132229 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 12040C636CC for ; Tue, 7 Feb 2023 23:53:58 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 8B83C82B; Wed, 8 Feb 2023 00:53:05 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 8B83C82B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1675814035; bh=O47+Z3xHlEPvA3EkAC8CD1HpeFgOayEc9QZ2VM48II4=; h=From:To:Subject:Date:In-Reply-To:References:CC:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=Mq/DJT4s6Pl20V3AxdofvNA9Edd8U+RW1WZDqJjNPP2H/51jEPTlyNqozC8Y0rRfD Ya5zXs5DzMAsLTKLa4gJxuEwSrAajJmqKMjJvjFRQmrK39p6PjH7JG3t9inAn6nBfC VtOo87mptmqWlQ3FQEFvuZuD+RQGRO2Hf3Schzlw= Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 601E8F80518; Wed, 8 Feb 2023 00:52:16 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 459C2F80152; Wed, 8 Feb 2023 00:52:12 +0100 (CET) Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 2F151F8010B for ; Wed, 8 Feb 2023 00:52:10 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 2F151F8010B Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pPTVE-0008RR-Dk; Tue, 07 Feb 2023 20:19:40 +0100 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.94.2) (envelope-from ) id 1pPTV8-003LvI-MN; Tue, 07 Feb 2023 20:19:35 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1pPTV9-001ewF-5V; Tue, 07 Feb 2023 20:19:35 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Jaroslav Kysela , Takashi Iwai , Thierry Reding , Jonathan Hunter , Geoff Levand , Michael Ellerman Subject: [PATCH 3/3] ALSA: core: Make snd_card_free() return void Date: Tue, 7 Feb 2023 20:19:07 +0100 Message-Id: <20230207191907.467756-4-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230207191907.467756-1-u.kleine-koenig@pengutronix.de> References: <20230207191907.467756-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2972; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=O47+Z3xHlEPvA3EkAC8CD1HpeFgOayEc9QZ2VM48II4=; b=owEBbQGS/pANAwAKAcH8FHityuwJAcsmYgBj4qQmhDeyRlzDiz4Ho2IBZI1JxNOaUyuQPiafPUYI jyZ4suKJATMEAAEKAB0WIQR+cioWkBis/z50pAvB/BR4rcrsCQUCY+KkJgAKCRDB/BR4rcrsCdv8B/ 4juquHrXABzHAxXa2jsb+yYy9SbW0eK+ivumKOfnnqAQVI/K9AMWA5Ape2ZQzEyWv+04URf2NpBcyd R062QjReZ/m1EcLyv2VhC+S8x2uLbtrNb4/LOYcjrj520O/pK61dHubzX+sq44tp3gjBHL1hb3BhH8 IS4u4KWYLORwQChPYI5keHujE6MzyDB0PqJJ8zhg7VVvMY3Cl4N/4xiqLzHHPEe2D2SIkft97Dr5vO IjVxJiqZpKa2tB98LGCr5vZaOtfYnYBXHUgl648JTLNYTgObwBJBE0PwsDjPOu981aOA+9F+/e0hNm o/hgb+BmLYrspQNxV9NBkYhSVxwmtw X-Developer-Key: i=u.kleine-koenig@pengutronix.de; a=openpgp; fpr=0D2511F322BFAB1C1580266BE2DCDD9132669BD6 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: alsa-devel@alsa-project.org Message-ID-Hash: M6HYT53RRRB5JYWQDMCAHYK3KOVAGCJC X-Message-ID-Hash: M6HYT53RRRB5JYWQDMCAHYK3KOVAGCJC X-MailFrom: ukl@pengutronix.de X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Nicholas Piggin , Christophe Leroy , alsa-devel@alsa-project.org, kernel@pengutronix.de, linux-tegra@vger.kernel.org, linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: The function returns 0 unconditionally. Make it return void instead and simplify all callers accordingly. Signed-off-by: Uwe Kleine-König Acked-by: Geoff Levand Acked-by: Thierry Reding --- include/sound/core.h | 2 +- sound/core/init.c | 6 ++---- sound/pci/hda/hda_tegra.c | 6 ++---- sound/ppc/snd_ps3.c | 4 +--- 4 files changed, 6 insertions(+), 12 deletions(-) diff --git a/include/sound/core.h b/include/sound/core.h index 21884c979c17..3edc4ab08774 100644 --- a/include/sound/core.h +++ b/include/sound/core.h @@ -288,7 +288,7 @@ int snd_devm_card_new(struct device *parent, int idx, const char *xid, void snd_card_disconnect(struct snd_card *card); void snd_card_disconnect_sync(struct snd_card *card); -int snd_card_free(struct snd_card *card); +void snd_card_free(struct snd_card *card); void snd_card_free_when_closed(struct snd_card *card); int snd_card_free_on_error(struct device *dev, int ret); void snd_card_set_id(struct snd_card *card, const char *id); diff --git a/sound/core/init.c b/sound/core/init.c index 6bb3e2b77971..df0c22480375 100644 --- a/sound/core/init.c +++ b/sound/core/init.c @@ -632,7 +632,7 @@ EXPORT_SYMBOL(snd_card_free_when_closed); * Return: Zero. Frees all associated devices and frees the control * interface associated to given soundcard. */ -int snd_card_free(struct snd_card *card) +void snd_card_free(struct snd_card *card) { DECLARE_COMPLETION_ONSTACK(released); @@ -643,15 +643,13 @@ int snd_card_free(struct snd_card *card) * the check here at the beginning. */ if (card->releasing) - return 0; + return; card->release_completion = &released; snd_card_free_when_closed(card); /* wait, until all devices are ready for the free operation */ wait_for_completion(&released); - - return 0; } EXPORT_SYMBOL(snd_card_free); diff --git a/sound/pci/hda/hda_tegra.c b/sound/pci/hda/hda_tegra.c index 976a112c7d00..c2bf86781894 100644 --- a/sound/pci/hda/hda_tegra.c +++ b/sound/pci/hda/hda_tegra.c @@ -582,12 +582,10 @@ static void hda_tegra_probe_work(struct work_struct *work) static int hda_tegra_remove(struct platform_device *pdev) { - int ret; - - ret = snd_card_free(dev_get_drvdata(&pdev->dev)); + snd_card_free(dev_get_drvdata(&pdev->dev)); pm_runtime_disable(&pdev->dev); - return ret; + return 0; } static void hda_tegra_shutdown(struct platform_device *pdev) diff --git a/sound/ppc/snd_ps3.c b/sound/ppc/snd_ps3.c index 631a61ce52f4..8d349231205e 100644 --- a/sound/ppc/snd_ps3.c +++ b/sound/ppc/snd_ps3.c @@ -1053,9 +1053,7 @@ static void snd_ps3_driver_remove(struct ps3_system_bus_device *dev) * ctl and preallocate buffer will be freed in * snd_card_free */ - ret = snd_card_free(the_card.card); - if (ret) - pr_info("%s: ctl freecard=%d\n", __func__, ret); + snd_card_free(the_card.card); dma_free_coherent(&dev->core, PAGE_SIZE,