Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp4174903ioo; Wed, 25 May 2022 17:22:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxDrfWoGE0KCNIXzcmvlY16xZHyp9AxfUPFIHdnRCrBxFr0PgSCSorQqEXVB6f8Y5fxaml7 X-Received: by 2002:a17:90b:3e8a:b0:1e0:51fa:516b with SMTP id rj10-20020a17090b3e8a00b001e051fa516bmr13283640pjb.151.1653524565669; Wed, 25 May 2022 17:22:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653524565; cv=none; d=google.com; s=arc-20160816; b=RKhEp3zL/NWhAS4blPbwrfH7Ymt2koU3ypoI14uVkPG+EWVHSwahkYxXVrOG49gX8q LvUvQIwKRfxxpGL6/I91R7J/xOHPIajnmonpZDlKckmSJgoBzy4j0FOu2/a0J7r75WJk 1g3O4GCWWKVGLZXTz8S34V0LoDayFwD9rd0P0t4uvrLBpdsbqO20j5jgIrzTHLAaDS5Y A/VMpemdbxLA/OglRq27I2pM6yFmU6LDOY0BrOA01Ml10zthEcZZtld/ux7F9j+GFXXC kB3IOfMLOsOydYyVQMcmqXv2WvwS6rf7ttny5t6yGif28XFTJbxpNVmYokt8RJs+l2BZ 0JfA== 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:dkim-signature; bh=PgHgErv4cia5Q5pV59X+EoYsMXAGMf+sFfFpeHS3CJo=; b=Pq5PKb59vdpv6nO8GHnsXJtprnPMnz0Us9MBRbFAk3+LvJBYJkHJR325uzRmlDDY+G sveZjN1cSld1j7AsBiWV3/aaocMkpNjpZJcAAIPG+gHdrTgYxUIpIynxJ2CvHT9PBSIs B4BUHD+mbL/1qNhcpP+aWOXvE0WOStxOYR+ufhLVCQCnyhKYTDaHSwBPcyi3jS3f1zzN b2nHkEgOLyFyXdE4AvwnN9lm0MMTNsFH3Tc8sb7PJSOW1s+/Q63o4Cb8TUsWQ7EmNUed gIPL6JLswoHv/TCqGrGDuSSaFYzx9mr5PJYQIVrD3lnqBTgQKQiG4qWTMyfJJEjMDCyd 4jwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2016061301 header.b=mQPzRGsn; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b6-20020a056a000cc600b0050d96e21e3asi25534053pfv.171.2022.05.25.17.22.33; Wed, 25 May 2022 17:22:45 -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; dkim=pass header.i=@walle.cc header.s=mail2016061301 header.b=mQPzRGsn; 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 S235305AbiEYXNE (ORCPT + 99 others); Wed, 25 May 2022 19:13:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45950 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232384AbiEYXNA (ORCPT ); Wed, 25 May 2022 19:13:00 -0400 Received: from ssl.serverraum.org (ssl.serverraum.org [IPv6:2a01:4f8:151:8464::1:2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1351CA5ABE; Wed, 25 May 2022 16:12:57 -0700 (PDT) Received: from mwalle01.kontron.local. (unknown [213.135.10.150]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by ssl.serverraum.org (Postfix) with ESMTPSA id 2C8DF22247; Thu, 26 May 2022 01:12:48 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc; s=mail2016061301; t=1653520370; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=PgHgErv4cia5Q5pV59X+EoYsMXAGMf+sFfFpeHS3CJo=; b=mQPzRGsnwoimzjnIY+beZew7XlmRS2VzkaTHBxydn78Y/INKEmQ/9IMbBm6YqlSdzd12dq Rn2XffyW/ibR0ktlaTMQDeBA/nuhuhdgRjns8sli9bSUOYVX0VOuSDF5YlQFJSyBIWYwMD AEbzHCIOVfOP1TwJ6y3xRvUx3paFZuw= From: Michael Walle To: Horatiu Vultur , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, UNGLinuxDriver@microchip.com, Michael Walle Subject: [PATCH net] net: lan966x: check devm_of_phy_get() for -EDEFER_PROBE Date: Thu, 26 May 2022 01:12:39 +0200 Message-Id: <20220525231239.1307298-1-michael@walle.cc> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE 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-kernel@vger.kernel.org At the moment, if devm_of_phy_get() returns an error the serdes simply isn't set. While it is bad to ignore an error in general, there is a particular bug that network isn't working if the serdes driver is compiled as a module. In that case, devm_of_phy_get() returns -EDEFER_PROBE and the error is silently ignored. The serdes is optional, it is not there if the port is using RGMII, in which case devm_of_phy_get() returns -ENODEV. Rearrange the error handling so that -ENODEV will be handled but other error codes will abort the probing. Fixes: d28d6d2e37d1 ("net: lan966x: add port module support") Signed-off-by: Michael Walle --- drivers/net/ethernet/microchip/lan966x/lan966x_main.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_main.c b/drivers/net/ethernet/microchip/lan966x/lan966x_main.c index 6ad68b422129..5784c4161e5e 100644 --- a/drivers/net/ethernet/microchip/lan966x/lan966x_main.c +++ b/drivers/net/ethernet/microchip/lan966x/lan966x_main.c @@ -1120,8 +1120,13 @@ static int lan966x_probe(struct platform_device *pdev) lan966x->ports[p]->fwnode = fwnode_handle_get(portnp); serdes = devm_of_phy_get(lan966x->dev, to_of_node(portnp), NULL); - if (!IS_ERR(serdes)) - lan966x->ports[p]->serdes = serdes; + if (PTR_ERR(serdes) == -ENODEV) + serdes = NULL; + if (IS_ERR(serdes)) { + err = PTR_ERR(serdes); + goto cleanup_ports; + } + lan966x->ports[p]->serdes = serdes; lan966x_port_init(lan966x->ports[p]); } -- 2.30.2