From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Heiner Kallweit <hkallweit1@gmail.com>
Cc: Krzysztof Kozlowski <krzk@kernel.org>,
Andrew Lunn <andrew@lunn.ch>,
Florian Fainelli <f.fainelli@gmail.com>,
David Miller <davem@davemloft.net>,
netdev@vger.kernel.org, Geert Uytterhoeven <geert@linux-m68k.org>
Subject: Re: [net-next] net: phy: fix issue with loading PHY driver w/o initramfs
Date: Tue, 22 Jan 2019 16:52:45 +0100 [thread overview]
Message-ID: <20190122155245.12238-1-geert@linux-m68k.org> (raw)
In-Reply-To: <8699eccc-4a12-09d2-5322-4e2533215258@gmail.com>
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 <krzk@kernel.org>
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
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
next prev parent reply other threads:[~2019-01-22 15:53 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-19 9:30 [PATCH net-next] net: phy: fix issue with loading PHY driver w/o initramfs Heiner Kallweit
2019-01-21 14:46 ` Krzysztof Kozlowski
2019-01-22 15:52 ` Geert Uytterhoeven [this message]
2019-01-22 22:45 ` David Miller
2019-01-23 6:08 ` Heiner Kallweit
2019-01-23 10:06 ` [net-next] " Geert Uytterhoeven
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190122155245.12238-1-geert@linux-m68k.org \
--to=geert@linux-m68k.org \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=hkallweit1@gmail.com \
--cc=krzk@kernel.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox