From patchwork Tue Jan 24 18:37:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 646470 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 13A35C54E94 for ; Tue, 24 Jan 2023 18:38:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232896AbjAXSiP (ORCPT ); Tue, 24 Jan 2023 13:38:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233689AbjAXSiJ (ORCPT ); Tue, 24 Jan 2023 13:38:09 -0500 Received: from michel.telenet-ops.be (michel.telenet-ops.be [IPv6:2a02:1800:110:4::f00:18]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9542D460B3 for ; Tue, 24 Jan 2023 10:38:00 -0800 (PST) Received: from ramsan.of.borg ([IPv6:2a02:1810:ac12:ed50:2f4a:8573:c294:b2ce]) by michel.telenet-ops.be with bizsmtp id CidZ2900556uRqi06idZyA; Tue, 24 Jan 2023 19:37:58 +0100 Received: from rox.of.borg ([192.168.97.57]) by ramsan.of.borg with esmtp (Exim 4.95) (envelope-from ) id 1pKOAe-007HCY-JX; Tue, 24 Jan 2023 19:37:33 +0100 Received: from geert by rox.of.borg with local (Exim 4.95) (envelope-from ) id 1pKOAn-002n0l-3x; Tue, 24 Jan 2023 19:37:33 +0100 From: Geert Uytterhoeven To: Vinod Koul , Jonathan Corbet , 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 , Kishon Vijay Abraham I , Alan Stern , Greg Kroah-Hartman , Krzysztof Kozlowski , Alim Akhtar , Siddharth Vadapalli , Russell King Cc: linux-phy@lists.infradead.org, linux-doc@vger.kernel.org, netdev@vger.kernel.org, linux-tegra@vger.kernel.org, linux-pci@vger.kernel.org, linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, Geert Uytterhoeven , Sean Anderson Subject: [PATCH v2 4/9] net: fman: memac: Convert to devm_of_phy_optional_get() Date: Tue, 24 Jan 2023 19:37:23 +0100 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org Use the new devm_of_phy_optional_get() helper instead of open-coding the same operation. As devm_of_phy_optional_get() returns NULL if either the PHY cannot be found, or if support for the PHY framework is not enabled, it is no longer needed to check for -ENODEV or -ENOSYS. Signed-off-by: Geert Uytterhoeven Reviewed-by: Sean Anderson --- v2: - Add Reviewed-by, - Clarify removed checks for -ENODEV and -ENOSYS, - Remove error printing in case of real failures. --- drivers/net/ethernet/freescale/fman/fman_memac.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/freescale/fman/fman_memac.c b/drivers/net/ethernet/freescale/fman/fman_memac.c index 9349f841bd0645a0..ddd9d13f1166e120 100644 --- a/drivers/net/ethernet/freescale/fman/fman_memac.c +++ b/drivers/net/ethernet/freescale/fman/fman_memac.c @@ -1152,13 +1152,12 @@ int memac_initialization(struct mac_device *mac_dev, else memac->sgmii_pcs = pcs; - memac->serdes = devm_of_phy_get(mac_dev->dev, mac_node, "serdes"); - err = PTR_ERR(memac->serdes); - if (err == -ENODEV || err == -ENOSYS) { + memac->serdes = devm_of_phy_optional_get(mac_dev->dev, mac_node, + "serdes"); + if (!memac->serdes) { dev_dbg(mac_dev->dev, "could not get (optional) serdes\n"); - memac->serdes = NULL; } else if (IS_ERR(memac->serdes)) { - dev_err_probe(mac_dev->dev, err, "could not get serdes\n"); + err = PTR_ERR(memac->serdes); goto _return_fm_mac_free; }