From patchwork Sun Mar 26 14:21:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 667326 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 B4664C6FD1C for ; Sun, 26 Mar 2023 14:28:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232320AbjCZO2v (ORCPT ); Sun, 26 Mar 2023 10:28:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58598 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230203AbjCZO2u (ORCPT ); Sun, 26 Mar 2023 10:28:50 -0400 X-Greylist: delayed 450 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Sun, 26 Mar 2023 07:28:49 PDT Received: from smtp.smtpout.orange.fr (smtp-12.smtpout.orange.fr [80.12.242.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id C53571721 for ; Sun, 26 Mar 2023 07:28:49 -0700 (PDT) Received: from pop-os.home ([86.243.2.178]) by smtp.orange.fr with ESMTPA id gRFFphd6xpD2AgRFFplFF9; Sun, 26 Mar 2023 16:21:18 +0200 X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sun, 26 Mar 2023 16:21:18 +0200 X-ME-IP: 86.243.2.178 From: Christophe JAILLET To: Mauro Carvalho Chehab Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , linux-media@vger.kernel.org Subject: [PATCH] media: i2c: ov7670: Use the devm_clk_get_optional() helper Date: Sun, 26 Mar 2023 16:21:16 +0200 Message-Id: X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Use devm_clk_get_optional() instead of hand writing it. This saves some loC and improves the semantic. Signed-off-by: Christophe JAILLET --- drivers/media/i2c/ov7670.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/media/i2c/ov7670.c b/drivers/media/i2c/ov7670.c index b1bb0833571e..ecbded4f0765 100644 --- a/drivers/media/i2c/ov7670.c +++ b/drivers/media/i2c/ov7670.c @@ -1894,14 +1894,9 @@ static int ov7670_probe(struct i2c_client *client) info->pclk_hb_disable = true; } - info->clk = devm_clk_get(&client->dev, "xclk"); /* optional */ - if (IS_ERR(info->clk)) { - ret = PTR_ERR(info->clk); - if (ret == -ENOENT) - info->clk = NULL; - else - return ret; - } + info->clk = devm_clk_get_optional(&client->dev, "xclk"); + if (IS_ERR(info->clk)) + return PTR_ERR(info->clk); ret = ov7670_init_gpio(client, info); if (ret)