Received: by 2002:a05:6602:2086:0:0:0:0 with SMTP id a6csp3231506ioa; Mon, 25 Apr 2022 22:19:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx1SPGZo2hYPVVx8/+11589fgixtSlnb0dNQQA3GlWBkrk8ac9yKUvczZGIEfKuqAG2itEm X-Received: by 2002:a17:906:4fcb:b0:6f3:b710:9752 with SMTP id i11-20020a1709064fcb00b006f3b7109752mr299363ejw.445.1650950393239; Mon, 25 Apr 2022 22:19:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650950393; cv=none; d=google.com; s=arc-20160816; b=wH1WUEf2gOZU++1D/4m+YoREZwVwPUpfmpb8E+8JtyG+yUUGmjlLc8k8QK7PR1W3/A APe/vQUiQ6bwWcQbUYTVVxf9PlNmzu37KbKW2kOf1TX4VesobjpetwocjiDKQKFjZvkW NOpvrewWk4XErFbsC3Ub3g8ZIGfkJKuK1OCdGYCdWGb5I0ewKDEMZWSWV08WyIa+iwgd V+O4moEd2QCGyzRl3t2x3pySt1Oc/TTPlkHmLlpF1smdHgNYm7+g67lI6WHNQhzrxfUR 9OXYmOPZo67Tc5pBQNFRMcPn02CxRpn1VZYV79Qf//+5b4yiNdx1tpHixghRp5PYilYX sNDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=7DI/4yWN3y1GMnceS1NFP6W+fM0r79CNMIWUatbJf0I=; b=ovoiY4NqkdFUzBENWProTH/SJDbWsA1nW7R7ZnoS3sxw6EKXbLD0vp01ACny2S+5eV Qn18aJ8E25Eu3cpK8KSG+kV7w/zGYjOL3/UHLnd2xFlz7MzXI0tGPyDfYAMaluOI6QSt KurRPs0KHcW+8SokJkduS2EYpxI59EVkk68yNEaMy9MyOGW3l/N1uigPnkRfGspIvkaz lBDVMM4iRviSqw8TvVKwzCUG/tQTWA4WBvkCEZBiY5Sr5yY86h2/o9ZpOIWFhzGgvr5z Ynrs2QZndsYgF5XdF/gdpnommQIvM+Rh+a0RVT5juPl4Gt151xGJtFkiVd8XFad66PRY whPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=GCZuUnp9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bf2-20020a0564021a4200b00423dc7e8859si13116053edb.297.2022.04.25.22.19.29; Mon, 25 Apr 2022 22:19:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=GCZuUnp9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233967AbiDYJdP (ORCPT + 99 others); Mon, 25 Apr 2022 05:33:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55398 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240288AbiDYJcq (ORCPT ); Mon, 25 Apr 2022 05:32:46 -0400 Received: from mail-yw1-x1132.google.com (mail-yw1-x1132.google.com [IPv6:2607:f8b0:4864:20::1132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6040525C54; Mon, 25 Apr 2022 02:29:42 -0700 (PDT) Received: by mail-yw1-x1132.google.com with SMTP id 00721157ae682-2f7c57ee6feso46807627b3.2; Mon, 25 Apr 2022 02:29:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=7DI/4yWN3y1GMnceS1NFP6W+fM0r79CNMIWUatbJf0I=; b=GCZuUnp932JxImCO8yyc4Gc8wkN98T+o2cGsdEEVoxF899i6hRCXUz2OVFWzZcrvXj 76MEiMn2LB4F2TlZBPj1tpYKE1kWpUxpfMjGKbKEaKhvPn61cEgu+MTEtZuig9QuGO8D /cbW5lAIiXLyzhZPP0MKrlG/LXT1vBPRYMD18sTaeN5Kk1qRD2vRnDNdyjpz7Gmr1Udb UUgkkwngftahjHMpHyW8CdC42noowsLzEFVjhFvf7W+MglaDl1JpoMd+jWVHPMEkFhS4 iW2ZTI506E3XEKox9qIvbFG2L4CCcmZZMVYO8DC5FYdqtIJAyzaQjfDeHpyP2RL2H5WX EhSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=7DI/4yWN3y1GMnceS1NFP6W+fM0r79CNMIWUatbJf0I=; b=BFNN0NZQNht4unU39S23zLc619E7B7esdNZxqIDn2pCIM/HnYBlBMBpKiy+cqj+JVG TAKFNOCwL7RInnU6bkMD8s7wyjwPXxGr7R0Nq4h6qtjSS11kpddYj3yFNo6aeJbKweqY DtmreEDeEGQ0R0GNBl0oAN+8EKxWohn8xjzaLqueDzkrRZfvbzNozab2vYv/Ni1z5roA v4SbmOs3PKs4D8GrrjVRSvBbshyt71tai/dW5RAzoGjrz0mwcSYBl1q/pCXE2kRvY08K l3DUfh12oTOwDsfijP+HQY/LpdEXDzxNQJGYhoqwt+7lnYPK0DH2bsCp60fj1gYfgFmN SzaA== X-Gm-Message-State: AOAM533w2NHAHlyYiinh5lNzc54xbB+FH/mbSmjvePqF3CWiFu2sZpfo +rWZllzCIAKsTr5rGVd2uP7qp/YfXdqJl/EdKNk= X-Received: by 2002:a81:6a46:0:b0:2f4:dc3f:e8f8 with SMTP id f67-20020a816a46000000b002f4dc3fe8f8mr16106476ywc.292.1650878981595; Mon, 25 Apr 2022 02:29:41 -0700 (PDT) MIME-Version: 1.0 References: <20220421203555.29011-1-prabhakar.mahadev-lad.rj@bp.renesas.com> <20220421203555.29011-4-prabhakar.mahadev-lad.rj@bp.renesas.com> In-Reply-To: From: "Lad, Prabhakar" Date: Mon, 25 Apr 2022 10:29:15 +0100 Message-ID: Subject: Re: [PATCH 3/3] ASoC: sh: rz-ssi: Add a devres action to release the DMA channels To: Biju Das Cc: Prabhakar Mahadev Lad , Mark Brown , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , "alsa-devel@alsa-project.org" , Nobuhiro Iwamatsu , Pavel Machek , "linux-kernel@vger.kernel.org" , "linux-renesas-soc@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Biju, Thank you for the review. On Fri, Apr 22, 2022 at 7:52 AM Biju Das wrote: > > Hi Lad Prabhakar, > > Thanks for the patch. > > > Subject: [PATCH 3/3] ASoC: sh: rz-ssi: Add a devres action to release the > > DMA channels > > > > DMA channels requested by rz_ssi_dma_request() in rz_ssi_probe() were never > > released in the error path apart from one place. This patch fixes this > > issue by adding a devres action to release the DMA channels and dropping > > the single rz_ssi_release_dma_channels() call which was placed in the error > > path in case devm_snd_soc_register_component() failed. > > > > Fixes: 26ac471c5354 ("ASoC: sh: rz-ssi: Add SSI DMAC support") > > Reported-by: Pavel Machek > > Signed-off-by: Lad Prabhakar > > --- > > sound/soc/sh/rz-ssi.c | 12 ++++++++++-- > > 1 file changed, 10 insertions(+), 2 deletions(-) > > > > diff --git a/sound/soc/sh/rz-ssi.c b/sound/soc/sh/rz-ssi.c index > > d9a684e71ec3..f04da1bf5680 100644 > > --- a/sound/soc/sh/rz-ssi.c > > +++ b/sound/soc/sh/rz-ssi.c > > @@ -912,6 +912,11 @@ static const struct snd_soc_component_driver > > rz_ssi_soc_component = { > > .pcm_construct = rz_ssi_pcm_new, > > }; > > > > +static void rz_ssi_release_dma_channels_action(void *data) { > > + rz_ssi_release_dma_channels(data); > > +} > > + > > static int rz_ssi_probe(struct platform_device *pdev) { > > struct rz_ssi_priv *ssi; > > @@ -966,6 +971,11 @@ static int rz_ssi_probe(struct platform_device *pdev) > > dev_info(&pdev->dev, "DMA enabled"); > > ssi->playback.transfer = rz_ssi_dma_transfer; > > ssi->capture.transfer = rz_ssi_dma_transfer; > > + > > + ret = devm_add_action_or_reset(&pdev->dev, > > + rz_ssi_release_dma_channels_action, > > ssi); > > + if (ret) > > + return ret; > > } > > > > ssi->playback.priv = ssi; > > @@ -1027,8 +1037,6 @@ static int rz_ssi_probe(struct platform_device *pdev) > > rz_ssi_soc_dai, > > ARRAY_SIZE(rz_ssi_soc_dai)); > > if (ret < 0) { > > - rz_ssi_release_dma_channels(ssi); > > - > > Maybe we need to keep this as it is, otherwise DMA channel release will happen > after CLK disable and Reset assert. Ideally release the channel, disable the clock and assert > the reset. > Ok will move this call to individual error paths. > Similarly, you may want to add "rz_ssi_release_dma_channels(ssi)" for error path related to > Pm_runtime_resume_get. > yes this needs to go under all error paths except the pio chunk. > > Also with this change there is unbalanced release_dma_channels() one from devres and other from remove. > Agreed. Cheers, Prabhakar > Regards, > Biju > > > > > pm_runtime_put(ssi->dev); > > pm_runtime_disable(ssi->dev); > > reset_control_assert(ssi->rstc); > > -- > > 2.17.1 >