From patchwork Mon Aug 7 15:53:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 109572 Delivered-To: patch@linaro.org Received: by 10.182.109.195 with SMTP id hu3csp2915192obb; Mon, 7 Aug 2017 08:53:19 -0700 (PDT) X-Received: by 10.28.69.157 with SMTP id l29mr985436wmi.38.1502121199106; Mon, 07 Aug 2017 08:53:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502121199; cv=none; d=google.com; s=arc-20160816; b=M41m9fqDX8DaZvKPTdhPT0qVBMI0FnEf/kUwqbN/KLJ07CXQYfzSOzkS4B34oYambz +KIWCYDUTDf6jRD/Qq8tV19TG43FSS9FtpNvPF2F6U/s5tW5KwlSfea+5YnaA2+nNEfA rk7pY1+1wkf9t0c5LgRbqe+P9cKHvqNZjwfDS33jmYBvB00p5hw/D3kb/7AZD6SKRzdr zQHbR1JA9cpFUZiEuB99mL/hI7d48WDGGkMnOa7nZECxT6M9hp6Ug9+PndjsFo7twq2f tEnG9HM4HTSBBN0iyg/BW9QV9riSQlxqrWshrvWbAA6ZrevULh6G/18700Hq7B1aduv5 YAQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:date:message-id:in-reply-to:to:from :delivered-to:arc-authentication-results; bh=2sjROuIR4/o+B7Mlszfw0QU3S8Y/RL0mUNgWn8dzaVE=; b=EfQJu8Kn0eo2CdoPdwIwMePs67nYG6fZLl2X0atEJyEnI9ROLtn16oAteP/aW2mI3O p4gk8GVlS/EqOgcDcyi8aX1suGNb8RNEavHcQf8gKr6iD/7nGZG9dYb/UIyqqrFVRA87 dTMDbmVwItvJXowIU4uOC41SP58vuO3N2f6okGiFzQ7WUMTrehZJ2vsVpQXvZHJnhUZB ugx2rZj7m0hIcrbvyg9RQvEW+QrKT6eCKvKcWy0vIPoxowc2mZyV1hptAMqQdB0CwseL JjXglYAqr8Ieu4zU/a5T4tjjsFGzTJiQ3DpRP7cqsyiXizx3Qz3cvNSmzMt7fm+urD0S X1Xg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) smtp.mailfrom=alsa-devel-bounces@alsa-project.org Return-Path: Received: from alsa0.perex.cz (alsa0.perex.cz. [77.48.224.243]) by mx.google.com with ESMTP id 53si9040711wry.416.2017.08.07.08.53.18; Mon, 07 Aug 2017 08:53:19 -0700 (PDT) Received-SPF: pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) client-ip=77.48.224.243; Authentication-Results: mx.google.com; spf=pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 037F22672BB; Mon, 7 Aug 2017 17:53:17 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 28575267339; Mon, 7 Aug 2017 17:53:15 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail1.perex.cz X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD, SPF_PASS, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from mezzanine.sirena.org.uk (mezzanine.sirena.org.uk [106.187.55.193]) by alsa0.perex.cz (Postfix) with ESMTP id 0BF5C2672A8 for ; Mon, 7 Aug 2017 17:53:12 +0200 (CEST) Received: from debutante.sirena.org.uk ([2001:470:1f1d:6b5::3] helo=debutante) by mezzanine.sirena.org.uk with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1dekL3-0006f6-LS; Mon, 07 Aug 2017 15:53:07 +0000 Received: from broonie by debutante with local (Exim 4.89) (envelope-from ) id 1dekL0-0005S3-TW; Mon, 07 Aug 2017 16:53:02 +0100 From: Mark Brown To: Kuninori Morimoto In-Reply-To: <877eygjfx2.wl%kuninori.morimoto.gx@renesas.com> Message-Id: Date: Mon, 07 Aug 2017 16:53:02 +0100 X-SA-Exim-Connect-IP: 2001:470:1f1d:6b5::3 X-SA-Exim-Mail-From: broonie@sirena.org.uk X-SA-Exim-Version: 4.2.1 (built Tue, 02 Aug 2016 21:08:31 +0000) X-SA-Exim-Scanned: No (on mezzanine.sirena.org.uk); Unknown failure Cc: alsa-devel@alsa-project.org, Mark Brown , Simon Subject: [alsa-devel] Applied "ASoC: soc-core: remove duplicate mutex_unlock from snd_soc_unregister_component()" to the asoc tree X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org The patch ASoC: soc-core: remove duplicate mutex_unlock from snd_soc_unregister_component() has been applied to the asoc tree at git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark >From 21a035287e28ec225fe7dfd1fffc509efd26a5db Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Mon, 7 Aug 2017 02:06:40 +0000 Subject: [PATCH] ASoC: soc-core: remove duplicate mutex_unlock from snd_soc_unregister_component() Current snd_soc_unregister_component() is using multiple mutex_unlock() for found/non-found cases. But it is unreadable and confusable code. This patch tidyup current code to be readable. Signed-off-by: Kuninori Morimoto Signed-off-by: Mark Brown --- sound/soc/soc-core.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) -- 2.13.3 _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index b21488972198..3bb8c63564cf 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -3328,21 +3328,25 @@ EXPORT_SYMBOL_GPL(snd_soc_register_component); void snd_soc_unregister_component(struct device *dev) { struct snd_soc_component *component; + int found = 0; mutex_lock(&client_mutex); list_for_each_entry(component, &component_list, list) { - if (dev == component->dev && component->registered_as_component) - goto found; + if (dev != component->dev || + !component->registered_as_component) + continue; + + snd_soc_tplg_component_remove(component, SND_SOC_TPLG_INDEX_ALL); + snd_soc_component_del_unlocked(component); + found = 1; + break; } mutex_unlock(&client_mutex); - return; -found: - snd_soc_tplg_component_remove(component, SND_SOC_TPLG_INDEX_ALL); - snd_soc_component_del_unlocked(component); - mutex_unlock(&client_mutex); - snd_soc_component_cleanup(component); - kfree(component); + if (found) { + snd_soc_component_cleanup(component); + kfree(component); + } } EXPORT_SYMBOL_GPL(snd_soc_unregister_component);