From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2E618C282C4 for ; Tue, 22 Jan 2019 15:53:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0A47D21726 for ; Tue, 22 Jan 2019 15:53:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729092AbfAVPxA (ORCPT ); Tue, 22 Jan 2019 10:53:00 -0500 Received: from laurent.telenet-ops.be ([195.130.137.89]:46586 "EHLO laurent.telenet-ops.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728939AbfAVPw7 (ORCPT ); Tue, 22 Jan 2019 10:52:59 -0500 Received: from ramsan ([84.194.111.163]) by laurent.telenet-ops.be with bizsmtp id TTsv1z00D3XaVaC01TsvqQ; Tue, 22 Jan 2019 16:52:57 +0100 Received: from rox.of.borg ([192.168.97.57]) by ramsan with esmtp (Exim 4.90_1) (envelope-from ) id 1glyMB-00036Y-4H; Tue, 22 Jan 2019 16:52:55 +0100 Received: from geert by rox.of.borg with local (Exim 4.90_1) (envelope-from ) id 1glyMB-0003CG-1Y; Tue, 22 Jan 2019 16:52:55 +0100 From: Geert Uytterhoeven To: Heiner Kallweit Cc: Krzysztof Kozlowski , Andrew Lunn , Florian Fainelli , David Miller , netdev@vger.kernel.org, Geert Uytterhoeven Subject: Re: [net-next] net: phy: fix issue with loading PHY driver w/o initramfs Date: Tue, 22 Jan 2019 16:52:45 +0100 Message-Id: <20190122155245.12238-1-geert@linux-m68k.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <8699eccc-4a12-09d2-5322-4e2533215258@gmail.com> References: <8699eccc-4a12-09d2-5322-4e2533215258@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Hi Heiner, > It was reported that on a system with nfsboot and w/o initramfs network > fails because trying to load the PHY driver returns -ENOENT. Reason was > that due to missing initramfs the modprobe binary isn't available. > So we have to ignore error code -ENOENT. > > Fixes: 13d0ab6750b2 ("net: phy: check return code when requesting PHY driver module") > Reported-by: Krzysztof Kozlowski > Signed-off-by: Heiner Kallweit Thanks for your patch! > > --- a/drivers/net/phy/phy_device.c > +++ b/drivers/net/phy/phy_device.c > @@ -552,10 +552,12 @@ static int phy_request_driver_module(struct phy_device *dev, int phy_id) > > ret = request_module(MDIO_MODULE_PREFIX MDIO_ID_FMT, > MDIO_ID_ARGS(phy_id)); > - /* we only check for failures in executing the usermode binary, > - * not whether a PHY driver module exists for the PHY ID > + /* We only check for failures in executing the usermode binary, > + * not whether a PHY driver module exists for the PHY ID. > + * Accept -ENOENT because this may occur in case no initramfs exists, > + * then modprobe isn't available. > */ > - if (IS_ENABLED(CONFIG_MODULES) && ret < 0) { > + if (IS_ENABLED(CONFIG_MODULES) && ret < 0 && ret != -ENOENT) { > phydev_err(dev, "error %d loading PHY driver module for ID 0x%08x\n", > ret, phy_id); > return ret; While I believe this patch fixes the particular issue I was seeing, I'm not convinced it fixes other possible issues.  There are several different error cases in both the kernel (e.g. -ETIME) and userland that can cause request_module() to fail, without actually having any impact, if the particular PHY driver is builtin or already loaded. IMHO, if the wanted PHY is available, all errors returned by request_module() should be ignored. In other subsystems, this is handled like:     if (driver_is_missing)         request_module(...);     if (driver_is_missing)         return -E...; Note that most callers of request_module() don't even check the error code it returns: the only thing that matters is if the (possibly loaded) functionality is available afterwards or not. Thanks! Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds