From patchwork Fri Dec 24 06:47:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tzung-Bi Shih X-Patchwork-Id: 12698840 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 45E38C433F5 for ; Fri, 24 Dec 2021 06:49:16 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 1CAD71878; Fri, 24 Dec 2021 07:48:25 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 1CAD71878 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1640328555; bh=LOADherWWa6FuUqHDL12Th0Qd9laRT03IyiBRCdT7rg=; h=Date:In-Reply-To:References:Subject:From:To:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=d2bwOIlm2n87LiXLhS+1Ic75kSfV/HbiZ9PFntbRGD2QGsX/8l4QJz+nlu4c3poML Di7/IzGzODas5uMO+EqwcOvlWCTSUISiZuiyRrjuLa6kcnUkUiwJG+HHrXbuzuLspf jNMQSAIs59ldo9OKttTVDjyJOmyx2zKQRUfg2+L0= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 45482F8014B; Fri, 24 Dec 2021 07:47:53 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id A759FF8014B; Fri, 24 Dec 2021 07:47:51 +0100 (CET) Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 52438F800FD for ; Fri, 24 Dec 2021 07:47:45 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 52438F800FD Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="W6EkA2Y7" Received: by mail-yb1-xb49.google.com with SMTP id l28-20020a25b31c000000b005c27dd4987bso14071423ybj.18 for ; Thu, 23 Dec 2021 22:47:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=DuyyQrdRujaQuOc09Kz85J5yTDB7+92eu48NIv/9FJY=; b=W6EkA2Y7jc6l/3YLTZe22Y9Bl+izH6HcuPxl0YdyxvQqwcncPMRyJ6hqNSjnsps2VL CdCF+sP3jpvTsqcnhCK2aj05x2ruXpeNgE2/u86tH4aQN3GsqocmYiRmtS2Us9D9oKCq C1ZD0+9A7LuqGJhSDGH4HLY4sqRi+X+ByOi6Zcv4oG+AKMA4Gf8YKvmSUEe/VxbbiMeh RM6bgwdnHWyL4tb3lnt82LVQ7tLPoGJVpVIaFtUkDI6SwuhuTT/JOU0fzitkqikD/66P G+uq5ycJWcUR2rLYUJt2uE9vJTOECpgR72NGEnwbUEIogs0KZWGXyifbpXJS0EhaiLWc oqaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=DuyyQrdRujaQuOc09Kz85J5yTDB7+92eu48NIv/9FJY=; b=tcPH+86DNKYn+VkYQuy/bXg5O6dyDux2tBwtf8Be7gGONX4xLBVGW39IRE8pOxQYEZ 4vu328usIO4WDQS7e8g89LlYbuZSB21UA9k4su+RR3DycrBNKX30/Je91xYddaSUIPtP bzEafV9eMSknCIjAURjAJ6TjTLD2/b7+w0ZeJAGPUKlE5Nd1ii/OVWL2uOv5vECQ8hue vzAJDqkh5SZvHLjX1fC9ZcP3agFLgCVpkwlkOhOLzqXBl0DRHttbd1ztPb3niq+GH2Mi 7lbufEJv/UuKBoKK4vmRFujuotEdVVVnNkz2sSbwXRh7mm5R5xgSA46ztD2w/yst8mGc /TmQ== X-Gm-Message-State: AOAM530eLD0MAQOsQZ0whZ5uvU0xW2lknLR5edWahrP53UafU++XWi/x K1EtkWRAUEh/odz4tuLfFagl0t57SQqq X-Google-Smtp-Source: ABdhPJyxyOnobBFotEC9H3Y7XfYxbJppr7R71ZgBQtEMh1CduuG//5rKz4ocBoBYUBy4Vd1zee30pqaBUFtI X-Received: from tzungbi-z840.tpe.corp.google.com ([2401:fa00:1:10:af4e:fb49:1227:527b]) (user=tzungbi job=sendgmr) by 2002:a25:d756:: with SMTP id o83mr7325462ybg.394.1640328462794; Thu, 23 Dec 2021 22:47:42 -0800 (PST) Date: Fri, 24 Dec 2021 14:47:16 +0800 In-Reply-To: <20211224064719.2031210-1-tzungbi@google.com> Message-Id: <20211224064719.2031210-2-tzungbi@google.com> Mime-Version: 1.0 References: <20211224064719.2031210-1-tzungbi@google.com> X-Mailer: git-send-email 2.34.1.448.ga2b2bfdf31-goog Subject: [PATCH 1/4] ASoC: mediatek: mt8173: fix device_node leak From: Tzung-Bi Shih To: broonie@kernel.org Cc: tzungbi@google.com, alsa-devel@alsa-project.org, trevor.wu@mediatek.com, jiaxin.yu@mediatek.com X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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" Fixes the device_node leak. Signed-off-by: Tzung-Bi Shih --- sound/soc/mediatek/mt8173/mt8173-max98090.c | 3 +++ sound/soc/mediatek/mt8173/mt8173-rt5650-rt5514.c | 2 ++ sound/soc/mediatek/mt8173/mt8173-rt5650-rt5676.c | 2 ++ sound/soc/mediatek/mt8173/mt8173-rt5650.c | 2 ++ 4 files changed, 9 insertions(+) diff --git a/sound/soc/mediatek/mt8173/mt8173-max98090.c b/sound/soc/mediatek/mt8173/mt8173-max98090.c index 2408c9d3d9b3..65941dd2295d 100644 --- a/sound/soc/mediatek/mt8173/mt8173-max98090.c +++ b/sound/soc/mediatek/mt8173/mt8173-max98090.c @@ -180,6 +180,9 @@ static int mt8173_max98090_dev_probe(struct platform_device *pdev) if (ret) dev_err(&pdev->dev, "%s snd_soc_register_card fail %d\n", __func__, ret); + + of_node_put(codec_node); + of_node_put(platform_node); return ret; } diff --git a/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5514.c b/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5514.c index e6e824f3d24a..227b0b72c66e 100644 --- a/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5514.c +++ b/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5514.c @@ -218,6 +218,8 @@ static int mt8173_rt5650_rt5514_dev_probe(struct platform_device *pdev) if (ret) dev_err(&pdev->dev, "%s snd_soc_register_card fail %d\n", __func__, ret); + + of_node_put(platform_node); return ret; } diff --git a/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5676.c b/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5676.c index ba6fe3d90bfc..8df2ff2f2aab 100644 --- a/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5676.c +++ b/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5676.c @@ -285,6 +285,8 @@ static int mt8173_rt5650_rt5676_dev_probe(struct platform_device *pdev) if (ret) dev_err(&pdev->dev, "%s snd_soc_register_card fail %d\n", __func__, ret); + + of_node_put(platform_node); return ret; } diff --git a/sound/soc/mediatek/mt8173/mt8173-rt5650.c b/sound/soc/mediatek/mt8173/mt8173-rt5650.c index 9b933cce0b20..16ddf9f8bbcb 100644 --- a/sound/soc/mediatek/mt8173/mt8173-rt5650.c +++ b/sound/soc/mediatek/mt8173/mt8173-rt5650.c @@ -323,6 +323,8 @@ static int mt8173_rt5650_dev_probe(struct platform_device *pdev) if (ret) dev_err(&pdev->dev, "%s snd_soc_register_card fail %d\n", __func__, ret); + + of_node_put(platform_node); return ret; } From patchwork Fri Dec 24 06:47:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tzung-Bi Shih X-Patchwork-Id: 12698841 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 687F8C433F5 for ; Fri, 24 Dec 2021 06:49:32 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id A6DF21891; Fri, 24 Dec 2021 07:48:40 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz A6DF21891 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1640328570; bh=CX/kN1X2EeI+U9SJQY52OkxmlJkFSb3hqPAHEVVu76U=; h=Date:In-Reply-To:References:Subject:From:To:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=P93RMjrv4ZzVCGnpr4U5402pliSe8ryC0jV7x7JDUKgJ0S1i9ai1qfKv19tebxDpA TwxxN6DAxSOpPDVSnaSUkcWsn19VausCUxERY7KbnQD+T31LiHMr8fYVzt01pTUc7t WTcDFXR14D46fNxBBaxN1/6HbwZvjqTgXDlp0X4A= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 2E7A6F804E6; Fri, 24 Dec 2021 07:47:57 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 816F2F804E4; Fri, 24 Dec 2021 07:47:53 +0100 (CET) Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id C1F84F80084 for ; Fri, 24 Dec 2021 07:47:50 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz C1F84F80084 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="Q4Wm0THv" Received: by mail-yb1-xb49.google.com with SMTP id e131-20020a25d389000000b005fb5e6eb757so13912747ybf.22 for ; Thu, 23 Dec 2021 22:47:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=bHVXJypXN3aOoXE4Ah+y2EklftG79QfVrX/zH0Pv2ck=; b=Q4Wm0THvk0DiCn6qErDlkC3kMwS9Bh1qSSJG/PYqVJqzWZW65pyd+9m+zssfripzpZ JGd8N9+eESOMdZIQU2irrkLgBIANba1Kj6cVqau7TsvM4xAtzxamqBeu3KW15o+wHLI4 vLxI5Nq1BvGmJ5G/nGSfKIJowBbH/bKvMekWJ0qBRi7skwhmqCi+SuzwcCtjMU5Osv8z YynwzIyxk/N9VvDIYZYIrXcRisX5eyMhAxs/vPZvIz4Fk+DL5wOJOkxvgRlViNHTZQmY PotXTAhZMvxXqf8R1Hx5gYi7goz4NpozbEsLOw0GfUQnPhir5Z5F3MiNg5oljh8cLFWA MPkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=bHVXJypXN3aOoXE4Ah+y2EklftG79QfVrX/zH0Pv2ck=; b=3ZZmmvfFgirjUmztk+Uo/J3mSFxap+PjyVSsqP9UUEhbcI/puiq3wdKz+dxSv/A6U7 +GDE+LNoezVnsBjG/OYkt6p/vlo5h5i59aBI/ltgD0LTJwT26ogFOH7PCLsOsT9xfnGi lo7d5N5ZFlV+XKAL4+F8JTKMHUSYYCJRHhi2cQQI3nPfwlnKHnZtXqz6+uGAmGojGyqc b03FPGr/McM1e7EDxuD7lwhhg3DqOt+Wzsk/IuSoFhr1RnsJ2gd48vD5gFJ889r75tAx RMu4LwGHqTs+mZq6FXrwvfBsVtJaEqYeqw2fgF8U+VwEVvefgqpM+JLwMvizKqJ2mlXQ glqg== X-Gm-Message-State: AOAM533Hu+KHzfY80uwrrNlBTPiZbjXfNngtXvlaY588uliE4E3lHbbM zdZyEJ3eLJxcHxkoVY82OLaU6xHgsBm5 X-Google-Smtp-Source: ABdhPJyMT0R1eoun15Pt2V4z3nOy1KUmjv9Iz+9jrK99rHPW+hMKomTjOgedPCOMHI5/2bbTmKg1Nz8RCqdC X-Received: from tzungbi-z840.tpe.corp.google.com ([2401:fa00:1:10:af4e:fb49:1227:527b]) (user=tzungbi job=sendgmr) by 2002:a25:bf86:: with SMTP id l6mr7371605ybk.92.1640328468177; Thu, 23 Dec 2021 22:47:48 -0800 (PST) Date: Fri, 24 Dec 2021 14:47:17 +0800 In-Reply-To: <20211224064719.2031210-1-tzungbi@google.com> Message-Id: <20211224064719.2031210-3-tzungbi@google.com> Mime-Version: 1.0 References: <20211224064719.2031210-1-tzungbi@google.com> X-Mailer: git-send-email 2.34.1.448.ga2b2bfdf31-goog Subject: [PATCH 2/4] ASoC: mediatek: mt8183: fix device_node leak From: Tzung-Bi Shih To: broonie@kernel.org Cc: tzungbi@google.com, alsa-devel@alsa-project.org, trevor.wu@mediatek.com, jiaxin.yu@mediatek.com X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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" Fixes the device_node leak. Signed-off-by: Tzung-Bi Shih --- sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c | 6 +++++- sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c | 7 ++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c b/sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c index f8a72a5102ad..ca893feab7eb 100644 --- a/sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c +++ b/sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c @@ -781,7 +781,11 @@ static int mt8183_da7219_max98357_dev_probe(struct platform_device *pdev) return ret; } - return devm_snd_soc_register_card(&pdev->dev, card); + ret = devm_snd_soc_register_card(&pdev->dev, card); + + of_node_put(platform_node); + of_node_put(hdmi_codec); + return ret; } #ifdef CONFIG_OF diff --git a/sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c b/sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c index d5fc86132b49..19f8aead775d 100644 --- a/sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c +++ b/sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c @@ -780,7 +780,12 @@ mt8183_mt6358_ts3a227_max98357_dev_probe(struct platform_device *pdev) __func__, ret); } - return devm_snd_soc_register_card(&pdev->dev, card); + ret = devm_snd_soc_register_card(&pdev->dev, card); + + of_node_put(platform_node); + of_node_put(ec_codec); + of_node_put(hdmi_codec); + return ret; } #ifdef CONFIG_OF From patchwork Fri Dec 24 06:47:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tzung-Bi Shih X-Patchwork-Id: 12698843 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 D5CAAC433EF for ; Fri, 24 Dec 2021 06:50:04 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 090BC18E6; Fri, 24 Dec 2021 07:49:13 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 090BC18E6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1640328603; bh=fat8ERIjNb/d9G6sRZhbkJZJ0TDZGgqXbAL0+CPMLmk=; h=Date:In-Reply-To:References:Subject:From:To:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=FDNbrEwzHQCfFetaoD63vcqgohMRJIVUNNeqNC+Im767hVEUeWQHAi5ojjTUzRySO BHEh8bQTW9z/Jw5WfNHYnjOyAbh3HBQEn4xUu3/3EjiIqL4McpJgvtcorMJJDrxQVn B9TFU1RLGhTwXJWzks5vF1sKiMUtNRA0EtPIOnJc= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id E6D14F80507; Fri, 24 Dec 2021 07:48:06 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 58808F804FA; Fri, 24 Dec 2021 07:47:59 +0100 (CET) Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id E270AF80084 for ; Fri, 24 Dec 2021 07:47:55 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz E270AF80084 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="IhFEYiHN" Received: by mail-yb1-xb49.google.com with SMTP id l28-20020a25b31c000000b005c27dd4987bso14071914ybj.18 for ; Thu, 23 Dec 2021 22:47:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=DBV9yG4yD62rmNt2YrqNkuvo/t1I5YaVkAjhfMcjpIc=; b=IhFEYiHNbbNskWmqICyQc3io1R+U13Gkw6mYuUgmqj10czL0iX6p1i3zpuQy/e3zBf D7wtBhFOGrx7On0no/J0mr5dshh3paiQYrR3Ft4xMuzyZewET8kSGUwXqj62h1wfFcrE naz/rJVLGczT42Yv3vvv+wOYQFLycXsscdpPqmsNK0AXzNjQAf6rLx+rpjpRe7/Yv+8g fv4SqbXhM4NqiLwHrPciTIyUCFBKDkW1lDb4hWv6/m+JuNY2XIg4dYq7HbDsiBH5JJM3 j/M+Lvj7pqp2se4qoQelIjMEU7ucwURLUtVhJqG0iTbXPeBfFJv1wqmcAoaFNcKGTYzD D1eg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=DBV9yG4yD62rmNt2YrqNkuvo/t1I5YaVkAjhfMcjpIc=; b=lziNkx6R3CJweQXDW/BD8yFHX9oH+m6RhywSFBssAT3pFHZNPRDxCvzUte/zjQbqIf 8eKHL4+bf53P3BSlMyhml4Q83HTVLxNzPsFOpgDHneh94HpF8Qxe6XAQohi10yyI9nD+ iae24buDtq7QfywKeMGoUNLhT57jWUzy3Zgi4xS/LnP8WCbbNYZvI///03bClrGhdJje S8a61Y0UItYkJw9/GRnyxypXZbO5upXjjzcphiwO72NKbU1gne4wROblpBbY/VNHS1lu pWy82hOaby67YFGhaANpTsjA4uFNW0ATBg9/HdZIIlK2k+1SyKcGZGmS60iYv1B/mly7 DT1A== X-Gm-Message-State: AOAM532j5Iv/czPfCluwDpD3YQemZCku/O9ABX3ebULM7sEQfbYjtQf5 BTMnUlF0YOkzkiUP6HIyl2rob2ySImkV X-Google-Smtp-Source: ABdhPJzOmzSaGu5Bci32//Ef94ycXo1SLKLBT/R696dPf76k71CTArknUChrmIrmlOpu5yKXjwlOsw4lo6+I X-Received: from tzungbi-z840.tpe.corp.google.com ([2401:fa00:1:10:af4e:fb49:1227:527b]) (user=tzungbi job=sendgmr) by 2002:a25:e811:: with SMTP id k17mr4122391ybd.121.1640328473973; Thu, 23 Dec 2021 22:47:53 -0800 (PST) Date: Fri, 24 Dec 2021 14:47:18 +0800 In-Reply-To: <20211224064719.2031210-1-tzungbi@google.com> Message-Id: <20211224064719.2031210-4-tzungbi@google.com> Mime-Version: 1.0 References: <20211224064719.2031210-1-tzungbi@google.com> X-Mailer: git-send-email 2.34.1.448.ga2b2bfdf31-goog Subject: [PATCH 3/4] ASoC: mediatek: mt8173: reduce log verbosity in probe() From: Tzung-Bi Shih To: broonie@kernel.org Cc: tzungbi@google.com, alsa-devel@alsa-project.org, trevor.wu@mediatek.com, jiaxin.yu@mediatek.com X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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" Eliminates error messages if snd_soc_register_card() failed. Kernel emits messages if device probe error anyway. Signed-off-by: Tzung-Bi Shih --- sound/soc/mediatek/mt8173/mt8173-max98090.c | 3 --- sound/soc/mediatek/mt8173/mt8173-rt5650-rt5514.c | 3 --- sound/soc/mediatek/mt8173/mt8173-rt5650-rt5676.c | 3 --- sound/soc/mediatek/mt8173/mt8173-rt5650.c | 3 --- 4 files changed, 12 deletions(-) diff --git a/sound/soc/mediatek/mt8173/mt8173-max98090.c b/sound/soc/mediatek/mt8173/mt8173-max98090.c index 65941dd2295d..4cb90da89262 100644 --- a/sound/soc/mediatek/mt8173/mt8173-max98090.c +++ b/sound/soc/mediatek/mt8173/mt8173-max98090.c @@ -177,9 +177,6 @@ static int mt8173_max98090_dev_probe(struct platform_device *pdev) card->dev = &pdev->dev; ret = devm_snd_soc_register_card(&pdev->dev, card); - if (ret) - dev_err(&pdev->dev, "%s snd_soc_register_card fail %d\n", - __func__, ret); of_node_put(codec_node); of_node_put(platform_node); diff --git a/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5514.c b/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5514.c index 227b0b72c66e..b55122b99f07 100644 --- a/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5514.c +++ b/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5514.c @@ -215,9 +215,6 @@ static int mt8173_rt5650_rt5514_dev_probe(struct platform_device *pdev) card->dev = &pdev->dev; ret = devm_snd_soc_register_card(&pdev->dev, card); - if (ret) - dev_err(&pdev->dev, "%s snd_soc_register_card fail %d\n", - __func__, ret); of_node_put(platform_node); return ret; diff --git a/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5676.c b/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5676.c index 8df2ff2f2aab..5716d9299066 100644 --- a/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5676.c +++ b/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5676.c @@ -282,9 +282,6 @@ static int mt8173_rt5650_rt5676_dev_probe(struct platform_device *pdev) card->dev = &pdev->dev; ret = devm_snd_soc_register_card(&pdev->dev, card); - if (ret) - dev_err(&pdev->dev, "%s snd_soc_register_card fail %d\n", - __func__, ret); of_node_put(platform_node); return ret; diff --git a/sound/soc/mediatek/mt8173/mt8173-rt5650.c b/sound/soc/mediatek/mt8173/mt8173-rt5650.c index 16ddf9f8bbcb..fc164f4f95f8 100644 --- a/sound/soc/mediatek/mt8173/mt8173-rt5650.c +++ b/sound/soc/mediatek/mt8173/mt8173-rt5650.c @@ -320,9 +320,6 @@ static int mt8173_rt5650_dev_probe(struct platform_device *pdev) card->dev = &pdev->dev; ret = devm_snd_soc_register_card(&pdev->dev, card); - if (ret) - dev_err(&pdev->dev, "%s snd_soc_register_card fail %d\n", - __func__, ret); of_node_put(platform_node); return ret; From patchwork Fri Dec 24 06:47:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tzung-Bi Shih X-Patchwork-Id: 12698842 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 BF8DCC433EF for ; Fri, 24 Dec 2021 06:49:46 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id D5EF41840; Fri, 24 Dec 2021 07:48:54 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz D5EF41840 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1640328584; bh=Bk4rlE2ysNzzU1zqKjEJEAO/iRBb9Ct8VPBowJEwsW8=; h=Date:In-Reply-To:References:Subject:From:To:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=Do+gRZgKVo54JZL9wcMkVGTAw0YuoPFhluicp07RXVQ7geroWC5cvNhbfyHRWKxuj jIxk2R1Z50FllUmZ2P2CqQjXOj3zZVdfoPxXXTByNh3Rfsbv94OCctehMoCwtihe0J TPse89IE/tHQzyuGUHGspQrL5PYkNwJdOvs8G0vw= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 093D2F804F2; Fri, 24 Dec 2021 07:48:06 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 2E078F804FB; Fri, 24 Dec 2021 07:48:04 +0100 (CET) Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 3121CF804EC for ; Fri, 24 Dec 2021 07:48:01 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 3121CF804EC Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="TuhSmrb9" Received: by mail-yb1-xb49.google.com with SMTP id w9-20020a25c709000000b00608a9489fc1so13937241ybe.20 for ; Thu, 23 Dec 2021 22:48:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=nYgqirlztHzfWpxQ6fJoFC5JQqfRpMl4u4un11X0W2c=; b=TuhSmrb9SXoyY4A3qeqP1jKo6kyDZ0/9Y+nXC0W45/0yR1VbXn1KaRt9O5t/07DF+R sUIUPxi2haKkH62i4K7mMfrNax0QRuy/SGtKwRqIrkBHFyZUZpogymWNKLV//YgZZ/v/ r0oWvqzQJOsKbRMOaA/rXPOOC/YWwDbf+nJAtpn/QUCSGpyL5yRX7FudXcbZNisBBL+W S/8u8afkSDW8MqBL4YUj88SUAZ826FfbZmaEAn07JPr1ZSmOVfL5rEkbC4JWeLVXUK39 6GBpifhqmaRSC2ycoCccQC3AgjGuWTBPgMx8q3sZZbtWsAaL+vRhB0AElcG3/Gu4AQF5 YK/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=nYgqirlztHzfWpxQ6fJoFC5JQqfRpMl4u4un11X0W2c=; b=URL2YWWsGXUGsPZ7ft3XXUVw0YdY+XXHVGfmh4S2hsCx7k/tdc/WzV1/MRQv5OkLlf xU36NBLY7humsQlvfxc1CFFscOfWhEkHIPYxiEtzczTX6pOnXgvwhHyhCbWfXs/Vd0Jf +hc8cpxN8U2rLzzyRf4rHtvjv1E4WDhdgqlN3702dCAj5piV8OyEVsUMLda4qhz4hHGu 4Qwql0e1iGrEw66CF4IPJgaRTdylQJyn+ZYqpPN3lv2KHUntgRKFTIw2fpTvgFr5+1/R 2gC3W3WCISCpqVsB3zNsLOa1KfYLGsCrRcTMy6aPAX3nsnORexzWZSsIepvPBwT+dZiJ W3cQ== X-Gm-Message-State: AOAM533du0THhqdmXP4POztjHIwrOcDyyUVGz6n18LnKGPd69a7a/Gu6 tZ7NIP2IXXBDJzgoeZP1AU+USTtqNcYc X-Google-Smtp-Source: ABdhPJxP2Ww0hO5KrF6uagjLAK4PFmUIkEKMYU+IyL5YV8BNlWGh9ncUPd9Sb1LcKItVOX5oA7BL0gy63Ml2 X-Received: from tzungbi-z840.tpe.corp.google.com ([2401:fa00:1:10:af4e:fb49:1227:527b]) (user=tzungbi job=sendgmr) by 2002:a25:547:: with SMTP id 68mr7693849ybf.69.1640328479659; Thu, 23 Dec 2021 22:47:59 -0800 (PST) Date: Fri, 24 Dec 2021 14:47:19 +0800 In-Reply-To: <20211224064719.2031210-1-tzungbi@google.com> Message-Id: <20211224064719.2031210-5-tzungbi@google.com> Mime-Version: 1.0 References: <20211224064719.2031210-1-tzungbi@google.com> X-Mailer: git-send-email 2.34.1.448.ga2b2bfdf31-goog Subject: [PATCH 4/4] ASoC: mediatek: mt8195: release device_node after snd_soc_register_card From: Tzung-Bi Shih To: broonie@kernel.org Cc: tzungbi@google.com, alsa-devel@alsa-project.org, trevor.wu@mediatek.com, jiaxin.yu@mediatek.com X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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" Device nodes can be released after components have bound. Shortens the lifecycle of the device nodes. Releases the reference counts after snd_soc_register_card. Signed-off-by: Tzung-Bi Shih --- .../mt8195/mt8195-mt6359-rt1011-rt5682.c | 53 +++++---------- .../mt8195/mt8195-mt6359-rt1019-rt5682.c | 64 ++++++------------- 2 files changed, 36 insertions(+), 81 deletions(-) diff --git a/sound/soc/mediatek/mt8195/mt8195-mt6359-rt1011-rt5682.c b/sound/soc/mediatek/mt8195/mt8195-mt6359-rt1011-rt5682.c index 9cf907c49ea8..ce8dace6527c 100644 --- a/sound/soc/mediatek/mt8195/mt8195-mt6359-rt1011-rt5682.c +++ b/sound/soc/mediatek/mt8195/mt8195-mt6359-rt1011-rt5682.c @@ -31,9 +31,6 @@ #define RT5682S_DEV0_NAME "rt5682s.2-001a" struct mt8195_mt6359_rt1011_rt5682_priv { - struct device_node *platform_node; - struct device_node *hdmi_node; - struct device_node *dp_node; struct snd_soc_jack headset_jack; struct snd_soc_jack dp_jack; struct snd_soc_jack hdmi_jack; @@ -1047,6 +1044,7 @@ static int mt8195_mt6359_rt1011_rt5682_dev_probe(struct platform_device *pdev) struct snd_soc_card *card = &mt8195_mt6359_rt1011_rt5682_soc_card; struct snd_soc_dai_link *dai_link; struct mt8195_mt6359_rt1011_rt5682_priv *priv; + struct device_node *platform_node, *dp_node, *hdmi_node; int is5682s = 0; int ret, i; @@ -1065,38 +1063,35 @@ static int mt8195_mt6359_rt1011_rt5682_dev_probe(struct platform_device *pdev) if (!priv) return -ENOMEM; - priv->platform_node = of_parse_phandle(pdev->dev.of_node, - "mediatek,platform", 0); - if (!priv->platform_node) { + platform_node = of_parse_phandle(pdev->dev.of_node, + "mediatek,platform", 0); + if (!platform_node) { dev_dbg(&pdev->dev, "Property 'platform' missing or invalid\n"); return -EINVAL; } + dp_node = of_parse_phandle(pdev->dev.of_node, "mediatek,dptx-codec", 0); + hdmi_node = of_parse_phandle(pdev->dev.of_node, + "mediatek,hdmi-codec", 0); + for_each_card_prelinks(card, i, dai_link) { if (!dai_link->platforms->name) - dai_link->platforms->of_node = priv->platform_node; + dai_link->platforms->of_node = platform_node; if (strcmp(dai_link->name, "DPTX_BE") == 0) { - priv->dp_node = - of_parse_phandle(pdev->dev.of_node, - "mediatek,dptx-codec", 0); - - if (!priv->dp_node) { + if (!dp_node) { dev_dbg(&pdev->dev, "No property 'dptx-codec'\n"); } else { - dai_link->codecs->of_node = priv->dp_node; + dai_link->codecs->of_node = dp_node; dai_link->codecs->name = NULL; dai_link->codecs->dai_name = "i2s-hifi"; dai_link->init = mt8195_dptx_codec_init; } } else if (strcmp(dai_link->name, "ETDM3_OUT_BE") == 0) { - priv->hdmi_node = - of_parse_phandle(pdev->dev.of_node, - "mediatek,hdmi-codec", 0); - if (!priv->hdmi_node) { + if (!hdmi_node) { dev_dbg(&pdev->dev, "No property 'hdmi-codec'\n"); } else { - dai_link->codecs->of_node = priv->hdmi_node; + dai_link->codecs->of_node = hdmi_node; dai_link->codecs->name = NULL; dai_link->codecs->dai_name = "i2s-hifi"; dai_link->init = mt8195_hdmi_codec_init; @@ -1113,28 +1108,13 @@ static int mt8195_mt6359_rt1011_rt5682_dev_probe(struct platform_device *pdev) snd_soc_card_set_drvdata(card, priv); ret = devm_snd_soc_register_card(&pdev->dev, card); - if (ret) { - of_node_put(priv->hdmi_node); - of_node_put(priv->dp_node); - of_node_put(priv->platform_node); - } + of_node_put(platform_node); + of_node_put(dp_node); + of_node_put(hdmi_node); return ret; } -static int mt8195_mt6359_rt1011_rt5682_dev_remove(struct platform_device *pdev) -{ - struct snd_soc_card *card = platform_get_drvdata(pdev); - struct mt8195_mt6359_rt1011_rt5682_priv *priv = - snd_soc_card_get_drvdata(card); - - of_node_put(priv->hdmi_node); - of_node_put(priv->dp_node); - of_node_put(priv->platform_node); - - return 0; -} - #ifdef CONFIG_OF static const struct of_device_id mt8195_mt6359_rt1011_rt5682_dt_match[] = { {.compatible = "mediatek,mt8195_mt6359_rt1011_rt5682",}, @@ -1156,7 +1136,6 @@ static struct platform_driver mt8195_mt6359_rt1011_rt5682_driver = { .pm = &mt8195_mt6359_rt1011_rt5682_pm_ops, }, .probe = mt8195_mt6359_rt1011_rt5682_dev_probe, - .remove = mt8195_mt6359_rt1011_rt5682_dev_remove, }; module_platform_driver(mt8195_mt6359_rt1011_rt5682_driver); diff --git a/sound/soc/mediatek/mt8195/mt8195-mt6359-rt1019-rt5682.c b/sound/soc/mediatek/mt8195/mt8195-mt6359-rt1019-rt5682.c index fdd444138728..c15c58170e9d 100644 --- a/sound/soc/mediatek/mt8195/mt8195-mt6359-rt1019-rt5682.c +++ b/sound/soc/mediatek/mt8195/mt8195-mt6359-rt1019-rt5682.c @@ -43,10 +43,6 @@ struct sof_conn_stream { }; struct mt8195_mt6359_rt1019_rt5682_priv { - struct device_node *platform_node; - struct device_node *adsp_node; - struct device_node *hdmi_node; - struct device_node *dp_node; struct snd_soc_jack headset_jack; struct snd_soc_jack dp_jack; struct snd_soc_jack hdmi_jack; @@ -1257,6 +1253,7 @@ static int mt8195_mt6359_rt1019_rt5682_dev_probe(struct platform_device *pdev) struct snd_soc_card *card = &mt8195_mt6359_rt1019_rt5682_soc_card; struct snd_soc_dai_link *dai_link; struct mt8195_mt6359_rt1019_rt5682_priv *priv; + struct device_node *platform_node, *adsp_node, *dp_node, *hdmi_node; int is5682s = 0; int init6359 = 0; int sof_on = 0; @@ -1278,19 +1275,21 @@ static int mt8195_mt6359_rt1019_rt5682_dev_probe(struct platform_device *pdev) if (!priv) return -ENOMEM; - priv->platform_node = of_parse_phandle(pdev->dev.of_node, - "mediatek,platform", 0); - if (!priv->platform_node) { + platform_node = of_parse_phandle(pdev->dev.of_node, + "mediatek,platform", 0); + if (!platform_node) { dev_dbg(&pdev->dev, "Property 'platform' missing or invalid\n"); return -EINVAL; } - /* dai link */ - priv->adsp_node = of_parse_phandle(pdev->dev.of_node, - "mediatek,adsp", 0); - if (priv->adsp_node) + adsp_node = of_parse_phandle(pdev->dev.of_node, "mediatek,adsp", 0); + if (adsp_node) sof_on = 1; + dp_node = of_parse_phandle(pdev->dev.of_node, "mediatek,dptx-codec", 0); + hdmi_node = of_parse_phandle(pdev->dev.of_node, + "mediatek,hdmi-codec", 0); + if (of_property_read_bool(pdev->dev.of_node, "mediatek,dai-link")) { ret = mt8195_dailink_parse_of(card, pdev->dev.of_node, "mediatek,dai-link"); @@ -1306,31 +1305,25 @@ static int mt8195_mt6359_rt1019_rt5682_dev_probe(struct platform_device *pdev) for_each_card_prelinks(card, i, dai_link) { if (!dai_link->platforms->name) { if (!strncmp(dai_link->name, "AFE_SOF", strlen("AFE_SOF")) && sof_on) - dai_link->platforms->of_node = priv->adsp_node; + dai_link->platforms->of_node = adsp_node; else - dai_link->platforms->of_node = priv->platform_node; + dai_link->platforms->of_node = platform_node; } if (strcmp(dai_link->name, "DPTX_BE") == 0) { - priv->dp_node = - of_parse_phandle(pdev->dev.of_node, - "mediatek,dptx-codec", 0); - if (!priv->dp_node) { + if (!dp_node) { dev_dbg(&pdev->dev, "No property 'dptx-codec'\n"); } else { - dai_link->codecs->of_node = priv->dp_node; + dai_link->codecs->of_node = dp_node; dai_link->codecs->name = NULL; dai_link->codecs->dai_name = "i2s-hifi"; dai_link->init = mt8195_dptx_codec_init; } } else if (strcmp(dai_link->name, "ETDM3_OUT_BE") == 0) { - priv->hdmi_node = - of_parse_phandle(pdev->dev.of_node, - "mediatek,hdmi-codec", 0); - if (!priv->hdmi_node) { + if (!hdmi_node) { dev_dbg(&pdev->dev, "No property 'hdmi-codec'\n"); } else { - dai_link->codecs->of_node = priv->hdmi_node; + dai_link->codecs->of_node = hdmi_node; dai_link->codecs->name = NULL; dai_link->codecs->dai_name = "i2s-hifi"; dai_link->init = mt8195_hdmi_codec_init; @@ -1357,30 +1350,14 @@ static int mt8195_mt6359_rt1019_rt5682_dev_probe(struct platform_device *pdev) snd_soc_card_set_drvdata(card, priv); ret = devm_snd_soc_register_card(&pdev->dev, card); - if (ret) { - of_node_put(priv->hdmi_node); - of_node_put(priv->dp_node); - of_node_put(priv->platform_node); - of_node_put(priv->adsp_node); - } + of_node_put(platform_node); + of_node_put(adsp_node); + of_node_put(dp_node); + of_node_put(hdmi_node); return ret; } -static int mt8195_mt6359_rt1019_rt5682_dev_remove(struct platform_device *pdev) -{ - struct snd_soc_card *card = platform_get_drvdata(pdev); - struct mt8195_mt6359_rt1019_rt5682_priv *priv = - snd_soc_card_get_drvdata(card); - - of_node_put(priv->hdmi_node); - of_node_put(priv->dp_node); - of_node_put(priv->platform_node); - of_node_put(priv->adsp_node); - - return 0; -} - #ifdef CONFIG_OF static const struct of_device_id mt8195_mt6359_rt1019_rt5682_dt_match[] = { {.compatible = "mediatek,mt8195_mt6359_rt1019_rt5682",}, @@ -1402,7 +1379,6 @@ static struct platform_driver mt8195_mt6359_rt1019_rt5682_driver = { .pm = &mt8195_mt6359_rt1019_rt5682_pm_ops, }, .probe = mt8195_mt6359_rt1019_rt5682_dev_probe, - .remove = mt8195_mt6359_rt1019_rt5682_dev_remove, }; module_platform_driver(mt8195_mt6359_rt1019_rt5682_driver);