From patchwork Sun Mar 26 12:43:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 75051 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp926406vqo; Sun, 26 Mar 2023 06:04:59 -0700 (PDT) X-Google-Smtp-Source: AKy350Yan6bJWxmrqI0+h2oOEzGaBfNUcV2ql32/xaM6UPsR5BAHD4xHQZ9W9SxhIhs152cLGbN6 X-Received: by 2002:a17:907:3e21:b0:930:f953:9614 with SMTP id hp33-20020a1709073e2100b00930f9539614mr12239795ejc.1.1679835898961; Sun, 26 Mar 2023 06:04:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679835898; cv=none; d=google.com; s=arc-20160816; b=K/JkS9XQiJ0TCKepvsoULwTGlKMeCnea8RKP90gNKBKbx97ibjtmD+ln1EkG2NOZuv xmv2EtrZfZg1gK+tR1jO7vK5+Jsy6eY9b9kwNJoHHFsLI85YZDjhVH/oiVeX5xQW8uDV /NZa62tOX1QnaKSMBcrOzIX0Nrh9CmaYa6OkVMYU9cQ34mKSNMShIJtJMeRzsEu/GsNN QfXqs3ZqqIiMw+SLMy5EaHgCwIalyPu8+vkUCOTo1D95x7pz3EoCVpCeKqZfQZpigh5z RWKPXAAD0qnTayGbZV/YoalC07OmOvp/RSLNaUF0r98mQ9f2SSvC7LP1CsWQCITzuG0F QdVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=vestg0NpqwYqPRRiGTwNgBzedimi/cs2Bb/VR9jRyrI=; b=gN+LODaaoWCyyXI2VzHZejV23wxj45RNvGfPH2eIO9C7yonPnEdY58LUUHQhjNKl64 4QsnsBzGMVmUxZdQT7RXdGou2EDOu7kaQOJJ8P7b1T2Pwt8YoV+o59F4JortfevMJ6rS 36Ma9BFuZQMH9oUmc5NGf2qOtzOL6BYpwORBaL2iuKJWfEX6ZqNM93+ePsrZThZMmx/l JHjyZxqostxH4QDAqRC8WbMCNulGoihRtECvp+8I18B1sQAoDTJjArHC88jtsRBj7XRN ruDszWKJbaNV6fKJgavIPbKcOnn695FgEJ7rFroR9fZK/giTkaIEQ2n6yMJZg9J5p6pz S77w== ARC-Authentication-Results: i=1; mx.google.com; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n21-20020aa7c455000000b004ad7c4bd9bdsi19042882edr.107.2023.03.26.06.04.36; Sun, 26 Mar 2023 06:04:58 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231873AbjCZMnq (ORCPT + 99 others); Sun, 26 Mar 2023 08:43:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37874 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229959AbjCZMnp (ORCPT ); Sun, 26 Mar 2023 08:43:45 -0400 Received: from smtp.smtpout.orange.fr (smtp-26.smtpout.orange.fr [80.12.242.26]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 50A0D7D9A for ; Sun, 26 Mar 2023 05:43:44 -0700 (PDT) Received: from pop-os.home ([86.243.2.178]) by smtp.orange.fr with ESMTPA id gPimpclLpV6zQgPimpzJp6; Sun, 26 Mar 2023 14:43:42 +0200 X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sun, 26 Mar 2023 14:43:42 +0200 X-ME-IP: 86.243.2.178 From: Christophe JAILLET To: Jerome Brunet , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Neil Armstrong , Kevin Hilman , Martin Blumenstingl Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , alsa-devel@alsa-project.org, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org Subject: [PATCH] ASoC: meson: Use the devm_clk_get_optional() helper Date: Sun, 26 Mar 2023 14:43:38 +0200 Message-Id: <8dab942d6ce47657a9c038295959be80bb2ee09e.1679834598.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS autolearn=unavailable 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761435607513259712?= X-GMAIL-MSGID: =?utf-8?q?1761435607513259712?= Use devm_clk_get_optional() instead of hand writing it. This saves some loC and improves the semantic. Signed-off-by: Christophe JAILLET Reviewed-by: Jerome Brunet --- sound/soc/meson/axg-tdm-interface.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/sound/soc/meson/axg-tdm-interface.c b/sound/soc/meson/axg-tdm-interface.c index 7624aafe9009..5e5e4c56d505 100644 --- a/sound/soc/meson/axg-tdm-interface.c +++ b/sound/soc/meson/axg-tdm-interface.c @@ -496,7 +496,7 @@ static int axg_tdm_iface_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct snd_soc_dai_driver *dai_drv; struct axg_tdm_iface *iface; - int ret, i; + int i; iface = devm_kzalloc(dev, sizeof(*iface), GFP_KERNEL); if (!iface) @@ -533,14 +533,9 @@ static int axg_tdm_iface_probe(struct platform_device *pdev) * At this point, ignore the error if mclk is missing. We'll * throw an error if the cpu dai is master and mclk is missing */ - iface->mclk = devm_clk_get(dev, "mclk"); - if (IS_ERR(iface->mclk)) { - ret = PTR_ERR(iface->mclk); - if (ret == -ENOENT) - iface->mclk = NULL; - else - return dev_err_probe(dev, ret, "failed to get mclk\n"); - } + iface->mclk = devm_clk_get_optional(dev, "mclk"); + if (IS_ERR(iface->mclk)) + return dev_err_probe(dev, PTR_ERR(iface->mclk), "failed to get mclk\n"); return devm_snd_soc_register_component(dev, &axg_tdm_iface_component_drv, dai_drv,