From patchwork Sat May 20 15:00:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 96802 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp419608vqo; Sat, 20 May 2023 08:16:32 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ583Eg3fza/cCsumJgj/30vGYQ4tJqDnNluwAchbGskdRqL42fxTZvkEtM/1RBdbm17gCP5 X-Received: by 2002:a05:6a21:78b:b0:f2:13cc:2914 with SMTP id mg11-20020a056a21078b00b000f213cc2914mr5710582pzb.16.1684595792649; Sat, 20 May 2023 08:16:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684595792; cv=none; d=google.com; s=arc-20160816; b=lxBPh13RfhMdlUtcWlOdAI0afe3RJx4pi0WvJc9QdF3vGf7q8OkLFYsPptMDOkyppR AdI43Wx13iZSA+AprKZZzM62NvYgEw9RePH1lfQ4Q4G8g2pcttuTlNioZMkA4GlR85L/ CGx5vyUPu6IT1gbCd+g9xLtsj0E1cqJfUwcGlT2ImuBxLQjc34c8CnK1BB8Hsb8hGOY4 NX3XLwKrTLu57op5Wwg2G5YNoEqIwBQFasycAzbE5y9OfM8QA4KRrwRSqzYbLZUyaA5G 4FIJfwcnAs7OcTLeznPJpqK7fAGzD8vl/MxqYqjxXibNfDQU0kNpgau4//dbTi/EXBfQ 9RSA== 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:dkim-signature; bh=5VvxviU32EnF0yUc09qoA4jqdLeStDT9+mAuA1G4mT8=; b=s2E/3qHPgTmawHmc+/caLj9uFtLpPNttArOR6Ielyr9aoC3w+L2YdDtgOq2GKihRWu FwFwreueSPLZpt0jPKh3BMIYGmZa7rn4AumnUO1LtmguWFm0uxNDSm9r1FEVsqqu1eXl W5mm0fc7PXz59NCJ7VnVC7JF0RYj2lrXlJ1PVNFrbvp+KOfmM3a9koiJYSkQvpYmroDS k9K9YU4/6UUlrii0Kf/ybfDVR6yM4o7WbYirhTzZ0yhpdqO2ptaRlR38mtq1eOaCTdEA ATsw01vjtQQjxqr9UMWfrUhOZn0lrBwDkUEz7fUyDnUs6m/LOZpB/peP/bb4LXjQrvwk qTGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=QyT70HvV; 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 k30-20020a637b5e000000b005250c24fa2esi1680918pgn.428.2023.05.20.08.16.17; Sat, 20 May 2023 08:16:32 -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=@wanadoo.fr header.s=t20230301 header.b=QyT70HvV; 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 S229960AbjETPA6 (ORCPT + 99 others); Sat, 20 May 2023 11:00:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230014AbjETPA4 (ORCPT ); Sat, 20 May 2023 11:00:56 -0400 Received: from smtp.smtpout.orange.fr (smtp-15.smtpout.orange.fr [80.12.242.15]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 396D1118 for ; Sat, 20 May 2023 08:00:55 -0700 (PDT) Received: from pop-os.home ([86.243.2.178]) by smtp.orange.fr with ESMTPA id 0O4hqFQmweM6M0O4iqgCiP; Sat, 20 May 2023 17:00:53 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1684594853; bh=5VvxviU32EnF0yUc09qoA4jqdLeStDT9+mAuA1G4mT8=; h=From:To:Cc:Subject:Date; b=QyT70HvV0e5RPfiuGIrnDb/2Rni0o2JNkfLH9Xnif4lQWNXymjTE4Pp8pXFvUuufv jAodpg9v2ARZslta04J0XOkseNB0plN7Gta57uvW+RwcGBsd7ANChzHaTYEYD67/A+ t7RPE59bhX6x1mwoaaOB9xIzomKA+h3J9Mw4f5dlJAjBzp6AiAP6HfM/kYYjfUe2ag KFSdS66CHdYGz8ctvva/4/sAhcqImOmUZ59GMfyExKNsrSFaXWfWd6daxlaVOaP392 1TdFD5Xk+Tz2/xAKb3gbZoPbaFloiA5dtXhg6vRLml1TapBPcqtUSMNUmu+as7ZIf6 MOMw8Bb4h58YQ== X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sat, 20 May 2023 17:00:53 +0200 X-ME-IP: 86.243.2.178 From: Christophe JAILLET To: Olivier Moysan , Arnaud Pouliquen , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Maxime Coquelin , Alexandre Torgue Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , alsa-devel@alsa-project.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org Subject: [PATCH] ASoC: stm32: sai: Use the devm_clk_get_optional() helper Date: Sat, 20 May 2023 17:00:50 +0200 Message-Id: X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE 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?1766426717954455570?= X-GMAIL-MSGID: =?utf-8?q?1766426717954455570?= Use devm_clk_get_optional() instead of hand writing it. This saves some LoC and improves the semantic. Signed-off-by: Christophe JAILLET --- sound/soc/stm/stm32_sai_sub.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/sound/soc/stm/stm32_sai_sub.c b/sound/soc/stm/stm32_sai_sub.c index f6695dee353b..271ec5b3378d 100644 --- a/sound/soc/stm/stm32_sai_sub.c +++ b/sound/soc/stm/stm32_sai_sub.c @@ -1485,12 +1485,9 @@ static int stm32_sai_sub_parse_of(struct platform_device *pdev, if (ret < 0) return ret; } else { - sai->sai_mclk = devm_clk_get(&pdev->dev, "MCLK"); - if (IS_ERR(sai->sai_mclk)) { - if (PTR_ERR(sai->sai_mclk) != -ENOENT) - return PTR_ERR(sai->sai_mclk); - sai->sai_mclk = NULL; - } + sai->sai_mclk = devm_clk_get_optional(&pdev->dev, "MCLK"); + if (IS_ERR(sai->sai_mclk)) + return PTR_ERR(sai->sai_mclk); } return 0;