From nobody Sat Apr 11 19:44:46 2026 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B0109C19F2A for ; Sun, 7 Aug 2022 21:21:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231599AbiHGVVE (ORCPT ); Sun, 7 Aug 2022 17:21:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35914 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229632AbiHGVVB (ORCPT ); Sun, 7 Aug 2022 17:21:01 -0400 Received: from smtp.smtpout.orange.fr (smtp-12.smtpout.orange.fr [80.12.242.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 924B8F3C for ; Sun, 7 Aug 2022 14:21:00 -0700 (PDT) Received: from pop-os.home ([90.11.190.129]) by smtp.orange.fr with ESMTPA id KnhdoqJG19qatKnhdouq0Z; Sun, 07 Aug 2022 23:20:58 +0200 X-ME-Helo: pop-os.home X-ME-Auth: YWZlNiIxYWMyZDliZWIzOTcwYTEyYzlhMmU3ZiQ1M2U2MzfzZDfyZTMxZTBkMTYyNDBjNDJlZmQ3ZQ== X-ME-Date: Sun, 07 Aug 2022 23:20:58 +0200 X-ME-IP: 90.11.190.129 From: Christophe JAILLET To: Miquel Raynal , Richard Weinberger , Vignesh Raghavendra Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , linux-mtd@lists.infradead.org Subject: [PATCH] mtd: rawnand: orion: Use devm_clk_get_optional() Date: Sun, 7 Aug 2022 23:20:51 +0200 Message-Id: X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Use devm_clk_get_optional() instead of hand writing it. While at it, use dev_err_probe() to further simplify the code. This is also less verbose if clk_get() returns -EPROBE_DEFER. Signed-off-by: Christophe JAILLET --- drivers/mtd/nand/raw/orion_nand.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/drivers/mtd/nand/raw/orion_nand.c b/drivers/mtd/nand/raw/orion= _nand.c index 2c87c7d89205..1bfecf502216 100644 --- a/drivers/mtd/nand/raw/orion_nand.c +++ b/drivers/mtd/nand/raw/orion_nand.c @@ -170,18 +170,11 @@ static int __init orion_nand_probe(struct platform_de= vice *pdev) =20 platform_set_drvdata(pdev, info); =20 - /* Not all platforms can gate the clock, so it is not - an error if the clock does not exists. */ - info->clk =3D devm_clk_get(&pdev->dev, NULL); - if (IS_ERR(info->clk)) { - ret =3D PTR_ERR(info->clk); - if (ret =3D=3D -ENOENT) { - info->clk =3D NULL; - } else { - dev_err(&pdev->dev, "failed to get clock!\n"); - return ret; - } - } + /* Not all platforms can gate the clock, so it is optional. */ + info->clk =3D devm_clk_get_optional(&pdev->dev, NULL); + if (IS_ERR(info->clk)) + return dev_err_probe(&pdev->dev, PTR_ERR(info->clk), + "failed to get clock!\n"); =20 ret =3D clk_prepare_enable(info->clk); if (ret) { --=20 2.34.1