From patchwork Wed Jan 18 10:15:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 1728138 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2620:137:e000::1:20; helo=out1.vger.email; envelope-from=linux-pci-owner@vger.kernel.org; receiver=) Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by legolas.ozlabs.org (Postfix) with ESMTP id 4Nxjh53bYhz23h2 for ; Wed, 18 Jan 2023 22:09:25 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230212AbjARLJX (ORCPT ); Wed, 18 Jan 2023 06:09:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57406 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230126AbjARLIu (ORCPT ); Wed, 18 Jan 2023 06:08:50 -0500 Received: from albert.telenet-ops.be (albert.telenet-ops.be [IPv6:2a02:1800:110:4::f00:1a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 191689574F for ; Wed, 18 Jan 2023 02:15:48 -0800 (PST) Received: from ramsan.of.borg ([IPv6:2a02:1810:ac12:ed50:4745:2e6d:e3a6:3327]) by albert.telenet-ops.be with bizsmtp id AAFN290052zf9gW06AFN2a; Wed, 18 Jan 2023 11:15:46 +0100 Received: from rox.of.borg ([192.168.97.57]) by ramsan.of.borg with esmtp (Exim 4.95) (envelope-from ) id 1pI5TQ-005aIZ-Ni; Wed, 18 Jan 2023 11:15:22 +0100 Received: from geert by rox.of.borg with local (Exim 4.95) (envelope-from ) id 1pI5TW-001JVv-27; Wed, 18 Jan 2023 11:15:22 +0100 From: Geert Uytterhoeven To: Madalin Bucur , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Horatiu Vultur , UNGLinuxDriver@microchip.com, Thierry Reding , Lorenzo Pieralisi , Rob Herring , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Bjorn Helgaas , Jonathan Hunter , Vinod Koul , Kishon Vijay Abraham I , Alan Stern , Greg Kroah-Hartman , Krzysztof Kozlowski , Alim Akhtar , Siddharth Vadapalli , Russell King Cc: netdev@vger.kernel.org, linux-tegra@vger.kernel.org, linux-pci@vger.kernel.org, linux-phy@lists.infradead.org, linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH 4/7] net: ethernet: ti: am65-cpsw: Convert to devm_of_phy_optional_get() Date: Wed, 18 Jan 2023 11:15:17 +0100 Message-Id: <63433d4641e4dd21b12232a6d72427cb62f3e987.1674036164.git.geert+renesas@glider.be> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_NONE autolearn=ham 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-pci@vger.kernel.org Use the new devm_of_phy_optional_get() helper instead of open-coding the same operation. While at it, fix handling of other error codes (e.g. -EPROBE_DEFER). Signed-off-by: Geert Uytterhoeven --- drivers/net/ethernet/ti/am65-cpsw-nuss.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/ti/am65-cpsw-nuss.c b/drivers/net/ethernet/ti/am65-cpsw-nuss.c index 5cac982841845369..794f228c8d632f7a 100644 --- a/drivers/net/ethernet/ti/am65-cpsw-nuss.c +++ b/drivers/net/ethernet/ti/am65-cpsw-nuss.c @@ -1460,9 +1460,9 @@ static int am65_cpsw_init_serdes_phy(struct device *dev, struct device_node *por struct phy *phy; int ret; - phy = devm_of_phy_get(dev, port_np, name); - if (PTR_ERR(phy) == -ENODEV) - return 0; + phy = devm_of_phy_optional_get(dev, port_np, name); + if (IS_ERR_OR_NULL(phy)) + return PTR_ERR_OR_ZERO(phy); /* Serdes PHY exists. Store it. */ port->slave.serdes_phy = phy;