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: 75086 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp969793vqo; Sun, 26 Mar 2023 07:34:00 -0700 (PDT) X-Google-Smtp-Source: AKy350bCiIrRJ2DRgzE47hAD8QNetS/BzDxrk9YyJanXUilNru30T3s5k+jXuO04dTMTiMyGqJzV X-Received: by 2002:a17:90b:3e86:b0:23d:e2b:cf1f with SMTP id rj6-20020a17090b3e8600b0023d0e2bcf1fmr8684606pjb.16.1679841240119; Sun, 26 Mar 2023 07:34:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679841240; cv=none; d=google.com; s=arc-20160816; b=V3EDZHnJcAt+0e8mZiSg/Zd5uyoj8CYqdPnpfR3E8yomda6ZoHlydCbJuGkuiYdcxK R0G3YbKTXmRdJgq/zobh4Lly0k+LQifLBiVZbPM4zY/cX1J+thliDP+BTXipbLb1nSEU ZQxT0YNyw70LgEPOePvbrEixL1h46oREzMUvqXd5sE0CE6k4hNxrPlT3aOOM7eWTj5EZ nkzu6He3WX7sVczonnYWeti6h3DAKWysq8y5MIcfThPkn4qOAK+OPRu/mgisW8S0eXXC W2Oaug8pW2iZdB7Tk70wfvje5uu5wA2sthm0kqr5Z9Xha+RpWZO3p/sEUh1jlQwv9cCq MgKA== 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=u0VylvSGGhQpiNuNti9CxYwXhmKdE9vAvQUveTSW6rk=; b=fV25oMBCHYvLIhPYvHDtSW3E2vKWmH8wITwz/9Dj+vsGLVorbiWzHrvpZ7e3Y/7GJq eLU324EGmrGxrHYCsL+z66rarTvZP4wKu1OdtcZrXagnIsBHbYsXbiPuW9P4iqFvqBAf 7IbWLerFPyIiVlY4/hq5ISEihnXb8N3yOqD7SFI+mLyGTYBuyxlh6LbIrer/M2q8avA6 b5p4loII+HLpLdqZx88pS51BlFjWddVwlxqr0lxGHlzoftMZyio7q8cGCXOm/bo3BEB0 Fc5OvlVwrh7VILrrzC9aScu4ORnBvCEIJ0HOvXM1RYlW2uJRpdsocPz+R721M9OpCerw TGBw== 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 on7-20020a17090b1d0700b00233c5363cdcsi8971752pjb.142.2023.03.26.07.33.47; Sun, 26 Mar 2023 07:34:00 -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 S232314AbjCZOVW (ORCPT + 99 others); Sun, 26 Mar 2023 10:21:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54872 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232306AbjCZOVV (ORCPT ); Sun, 26 Mar 2023 10:21:21 -0400 Received: from smtp.smtpout.orange.fr (smtp-11.smtpout.orange.fr [80.12.242.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C7DAC5BBE for ; Sun, 26 Mar 2023 07:21:19 -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 X-Spam-Status: No, score=-0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,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?1761441208373387745?= X-GMAIL-MSGID: =?utf-8?q?1761441208373387745?= 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)