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: 13114715 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 518D6C25B50 for ; Tue, 24 Jan 2023 19:46:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=0IpyoHWQXoRbcM5red6IqUqV4RvOjesVZs+mySL6hFI=; b=2w337uoNitkEKP T/kt2GZp+rn2SMCfeqrTZbGWjMrExB9r0heXzQ+KzlYEQC2mGrBedGZhhr3XSgkr9L/IPHf6UeEE5 PQ+c0VRaOtPtGB+MVrlOxFoUqK7pdaESFhyfp8fH/2CQ5F7kLE06p+8VWgUDukcZLG+cEi4jbXd3N s7TSLtJJyRLzcg03esljQY4rs59naOSoh2iSmUctF5He5bomVj9+pFY9HTELzEZOsm4T2zeSoI3MV 7ZUviHOrbZoq9Q6xOqZd9CV8tKeWHl6y9Fss/Y29EVVfv1k1SJu/A5mtkJQX7Zw+3svy1imfeuX8n stJKMYIi1X32WXyOk8HQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pKPFF-0053pR-5g; Tue, 24 Jan 2023 19:46:13 +0000 Received: from michel.telenet-ops.be ([2a02:1800:110:4::f00:18]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pKOBE-004xjU-OO for linux-arm-kernel@lists.infradead.org; Tue, 24 Jan 2023 18:38:05 +0000 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230124_103801_064403_C42DE6AA X-CRM114-Status: GOOD ( 14.03 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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; }