From patchwork Thu Jul 24 08:51:31 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 4615091 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 7E0699F375 for ; Thu, 24 Jul 2014 08:51:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AA24A201BC for ; Thu, 24 Jul 2014 08:51:54 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 640F62017D for ; Thu, 24 Jul 2014 08:51:53 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 545ED2657A6; Thu, 24 Jul 2014 10:51:52 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 161E0265685; Thu, 24 Jul 2014 10:51:42 +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 9E9EB265779; Thu, 24 Jul 2014 10:51:40 +0200 (CEST) Received: from mail-pa0-f52.google.com (mail-pa0-f52.google.com [209.85.220.52]) by alsa0.perex.cz (Postfix) with ESMTP id 7210D265675 for ; Thu, 24 Jul 2014 10:51:33 +0200 (CEST) Received: by mail-pa0-f52.google.com with SMTP id bj1so3509050pad.11 for ; Thu, 24 Jul 2014 01:51:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:message-id:from:subject:user-agent:to:cc:in-reply-to :references:mime-version:content-type; bh=7fbfWWiMxcbKWygEnMLbGBiDLIo6n9ZT+KF0Qye+Zec=; b=zRws9G5We7Isxqrec68Yqmv1MYQZWNlqSK0dMFKtfhzwuHxag1GwjKqQY6YQo2daNA ZbPbJIWmHdYSSKGQCH6qHSocSQEcyMzQ2DY2lNYxvry7C8AG2trwTkhXtOYIkPVrZVbM 0GtXi34JJgMn2HSpIMf/SG/HDJoGcQWc8cfbVWSqbZ8EkoIgW//1k8280UevUdnGdnli UuHzQqH7sZ5uEz16BVZDN+wDcr/3WO8VVwMQKkl3c8KtI8VXdI8kdLBzJ4uo5yLpVtyp 5okpxCG0Myv2MOTWaFzZCwvog0/rlldL35cwYTixvR6vJOMEZaqgO+6PAXIMj2lK6cd3 2XVA== X-Received: by 10.69.18.65 with SMTP id gk1mr8520328pbd.68.1406191891851; Thu, 24 Jul 2014 01:51:31 -0700 (PDT) Received: from remon.gmail.com (49.14.32.202.bf.2iij.net. [202.32.14.49]) by mx.google.com with ESMTPSA id dg10sm6451398pdb.72.2014.07.24.01.51.30 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 24 Jul 2014 01:51:31 -0700 (PDT) Date: Thu, 24 Jul 2014 01:51:31 -0700 (PDT) Message-ID: <87lhrj9m26.wl%kuninori.morimoto.gx@gmail.com> From: Kuninori Morimoto User-Agent: Wanderlust/2.14.0 Emacs/23.3 Mule/6.0 To: Mark Brown In-Reply-To: <87zjfzaata.wl%kuninori.morimoto.gx@gmail.com> References: <1406032431-3807-1-git-send-email-laurent.pinchart+renesas@ideasonboard.com> <87d2cwvmxa.wl%kuninori.morimoto.gx@gmail.com> <1815783.Bld4nzvI29@avalon> <87zjfzaata.wl%kuninori.morimoto.gx@gmail.com> MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Cc: Linux-ALSA , Simon , Liam Girdwood , Kuninori Morimoto , Laurent Pinchart Subject: [alsa-devel] [PATCH] ASoC: rsnd: fixup dai remove callback operation 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP From: Kuninori Morimoto rsnd driver is using SSI/SRC/DVC which are using "mod" base operation. These "mod" are supporting "probe" and "remove" callbacks. Current rsnd_probe should call "remove" if "probe" was failed, since "probe" might be having DMAEngine handle. Some mod's "remove" callback might be called without calling "probe", but it is no problem. because "remove" do nothing in such case. So, all mod's "remove" should be called when error case of rsnd_probe() and rsnd_remove(). Signed-off-by: Kuninori Morimoto --- sound/soc/sh/rcar/core.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c index 907d480..1b4d8700 100644 --- a/sound/soc/sh/rcar/core.c +++ b/sound/soc/sh/rcar/core.c @@ -1041,11 +1041,11 @@ static int rsnd_probe(struct platform_device *pdev) for_each_rsnd_dai(rdai, priv, i) { ret = rsnd_dai_call(probe, &rdai->playback, rdai); if (ret) - return ret; + goto exit_snd_probe; ret = rsnd_dai_call(probe, &rdai->capture, rdai); if (ret) - return ret; + goto exit_snd_probe; } /* @@ -1073,6 +1073,11 @@ static int rsnd_probe(struct platform_device *pdev) exit_snd_soc: snd_soc_unregister_platform(dev); +exit_snd_probe: + for_each_rsnd_dai(rdai, priv, i) { + rsnd_dai_call(remove, &rdai->playback, rdai); + rsnd_dai_call(remove, &rdai->capture, rdai); + } return ret; } @@ -1081,21 +1086,16 @@ static int rsnd_remove(struct platform_device *pdev) { struct rsnd_priv *priv = dev_get_drvdata(&pdev->dev); struct rsnd_dai *rdai; - int ret, i; + int ret = 0, i; pm_runtime_disable(&pdev->dev); for_each_rsnd_dai(rdai, priv, i) { - ret = rsnd_dai_call(remove, &rdai->playback, rdai); - if (ret) - return ret; - - ret = rsnd_dai_call(remove, &rdai->capture, rdai); - if (ret) - return ret; + ret |= rsnd_dai_call(remove, &rdai->playback, rdai); + ret |= rsnd_dai_call(remove, &rdai->capture, rdai); } - return 0; + return ret; } static struct platform_driver rsnd_driver = {