Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp328983pxj; Thu, 10 Jun 2021 23:40:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzNc19kyDS7KCWZc4GB0FV7EbEb5DrPMN+7ruTBgfg9hJCyzzvVZd1O/SSeLRra28kM4RYj X-Received: by 2002:a05:6402:543:: with SMTP id i3mr2107475edx.173.1623393631570; Thu, 10 Jun 2021 23:40:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623393631; cv=none; d=google.com; s=arc-20160816; b=Q8lPMJU28NtJhCq4O8h8xrnV0CjVh9jMimJo85WxfVntP5yCSu9TYq9wFCP0qNBDyq D2gecHqvGsGaHtBmBmT7lVrR5at7VTpdkw95Xta9LPTOHOM5pUsXI0RDLmKFCkG1prV3 rRWAz4WInnuMkgM29gxnYjpvnVh4L1uKJv0oIruokeMbuEMqxNYFoQh5ZhtO5l3ZebIE p7TacZY3HPy8zdgkbhETH2ZDnjdbTEd6xYjnCzPi0SvH6pl68/NmI0O6Dv4VqxT8o9cg vchiaiD5/I5/8rXw0L/1p3LjnHsD5NN9vU3YtLf6MKajhp7h4plNwEkoxbB+oQ1gwvyv x26Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from:dkim-filter :dkim-signature:dkim-filter; bh=x9r3mjo9myPoai+Ewzu7TLgGVipVL1jSKJszV5CRyXE=; b=ad0Mw7G/7ZoLfQp4ZPoo+Qqnq7ufCrNIjeB2scv8877GaJccswmNwGfR/i+T/o9qSQ +KARFBj1vcuRVyPM7vRE56M7SvQ4dyuEnBny7k69qOUVje8/x+WzkjJqt4PXxadjsyyS RndvAO6luy638v2JSKqftDIIg6e2XLZnEbm4daoBzMge087rgMWkFXnzgNDomqJhZyGl vygUHqtrhq9ma8jNB6ABESxe5XhEEN+lbrmwIgjnzMA5uu+/pzak9YAD/KE3r5kGXbkH ay29cf6TdUbIqwCITLC3voOAg7QwHBJvcglVcLFGIiqgILZyvSb8nlkhN6eMra5XCaXI Ya7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nxp.com header.s=nselector3 header.b=dV2As57f; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o22si4072124edq.221.2021.06.10.23.40.07; Thu, 10 Jun 2021 23:40:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=nselector3 header.b=dV2As57f; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229777AbhFKGil (ORCPT + 99 others); Fri, 11 Jun 2021 02:38:41 -0400 Received: from inva020.nxp.com ([92.121.34.13]:35502 "EHLO inva020.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229510AbhFKGil (ORCPT ); Fri, 11 Jun 2021 02:38:41 -0400 Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 40D111A08FB; Fri, 11 Jun 2021 08:36:43 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 inva020.eu-rdc02.nxp.com 40D111A08FB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=nselector3; t=1623393403; bh=x9r3mjo9myPoai+Ewzu7TLgGVipVL1jSKJszV5CRyXE=; h=From:To:Cc:Subject:Date:From; b=dV2As57fc9O82/cEtKmI6HJk0DPljB4jatogj/86XEAebYqRX/4RKpBOA9BePqIU5 UIQgPE7SYQk9WQOueK2IzlTuiB7RxU0+8EEIRibVeDTKY3XU6MtbsBF04LVDA/otdn ihRvBSGAYbNbFYVGEfBtc6aFX5xeCLY/E3l5KyEaWFlq5ZOPJc+p+umtrWthrJK7Dv X4aKXtpPJNLGOrDWskniLL2Fp2Oxu4lpx1v69XtnAmLAihrFlHMNCgn+JIy3YOL3ik IZpRcSpHoaZiqjweEX1wi/MBJh//GC5T2rzSPlyotSY53hY+tdmuOX2VsjJ6awor90 n/YZAd4UepYiQ== Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 1DD841A0903; Fri, 11 Jun 2021 08:36:39 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 inva020.eu-rdc02.nxp.com 1DD841A0903 Received: from localhost.localdomain (shlinux2.ap.freescale.net [10.192.224.44]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id 48C2740130; Fri, 11 Jun 2021 14:36:33 +0800 (+08) From: Shengjiu Wang To: timur@kernel.org, nicoleotsuka@gmail.com, Xiubo.Lee@gmail.com, festevam@gmail.com, broonie@kernel.org, perex@perex.cz, tiwai@suse.com, alsa-devel@alsa-project.org Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: [PATCH] ASoC: fsl_spdif: Fix error handler with pm_runtime_enable Date: Fri, 11 Jun 2021 14:18:38 +0800 Message-Id: <1623392318-26304-1-git-send-email-shengjiu.wang@nxp.com> X-Mailer: git-send-email 2.7.4 X-Virus-Scanned: ClamAV using ClamSMTP Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There is error message when defer probe happens: fsl-spdif-dai 2dab0000.spdif: Unbalanced pm_runtime_enable! Fix the error handler with pm_runtime_enable and add fsl_spdif_remove() for pm_runtime_disable. Fixes: 9cb2b3796e08 ("ASoC: fsl_spdif: Add pm runtime function") Signed-off-by: Shengjiu Wang --- sound/soc/fsl/fsl_spdif.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/sound/soc/fsl/fsl_spdif.c b/sound/soc/fsl/fsl_spdif.c index 2a76714eb8e6..76a7c9581333 100644 --- a/sound/soc/fsl/fsl_spdif.c +++ b/sound/soc/fsl/fsl_spdif.c @@ -1441,16 +1441,29 @@ static int fsl_spdif_probe(struct platform_device *pdev) &spdif_priv->cpu_dai_drv, 1); if (ret) { dev_err(&pdev->dev, "failed to register DAI: %d\n", ret); - return ret; + goto err_pm_disable; } ret = imx_pcm_dma_init(pdev, IMX_SPDIF_DMABUF_SIZE); - if (ret && ret != -EPROBE_DEFER) - dev_err(&pdev->dev, "imx_pcm_dma_init failed: %d\n", ret); + if (ret) { + dev_err_probe(&pdev->dev, ret, "imx_pcm_dma_init failed\n"); + goto err_pm_disable; + } + + return ret; +err_pm_disable: + pm_runtime_disable(&pdev->dev); return ret; } +static int fsl_spdif_remove(struct platform_device *pdev) +{ + pm_runtime_disable(&pdev->dev); + + return 0; +} + #ifdef CONFIG_PM static int fsl_spdif_runtime_suspend(struct device *dev) { @@ -1554,6 +1567,7 @@ static struct platform_driver fsl_spdif_driver = { .pm = &fsl_spdif_pm, }, .probe = fsl_spdif_probe, + .remove = fsl_spdif_remove, }; module_platform_driver(fsl_spdif_driver); -- 2.27.0