[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAKxU2N_x+DaoSZykT--94qphbXgLTU=QHSEQ0FO7VH2oPN=kmQ@mail.gmail.com>
Date: Wed, 4 Dec 2024 17:06:09 -0800
From: Rosen Penev <rosenp@...il.com>
To: "Russell King (Oracle)" <linux@...linux.org.uk>
Cc: netdev@...r.kernel.org, Kurt Kanzenbach <kurt@...utronix.de>,
Andrew Lunn <andrew@...n.ch>, Vladimir Oltean <olteanv@...il.com>,
"David S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>, Chris Snook <chris.snook@...il.com>,
Marcin Wojtas <marcin.s.wojtas@...il.com>,
Yoshihiro Shimoda <yoshihiro.shimoda.uh@...esas.com>,
Niklas Söderlund <niklas.soderlund@...natech.se>,
Richard Cochran <richardcochran@...il.com>, open list <linux-kernel@...r.kernel.org>,
"open list:RENESAS ETHERNET SWITCH DRIVER" <linux-renesas-soc@...r.kernel.org>
Subject: Re: [PATCHv4 net-next] net: modernize ioremap in probe
On Tue, Dec 3, 2024 at 2:51 PM Russell King (Oracle)
<linux@...linux.org.uk> wrote:
>
> On Tue, Dec 03, 2024 at 02:27:50PM -0800, Rosen Penev wrote:
> > resource aquisition and ioremap can be performed in one step.
> ...
> > diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
> > index 571631a30320..af9291574931 100644
> > --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
> > +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
> > @@ -7425,21 +7425,16 @@ static int mvpp2_init(struct platform_device *pdev, struct mvpp2 *priv)
> > static int mvpp2_get_sram(struct platform_device *pdev,
> > struct mvpp2 *priv)
> > {
> > - struct resource *res;
> > void __iomem *base;
> >
> > - res = platform_get_resource(pdev, IORESOURCE_MEM, 2);
> > - if (!res) {
> > + base = devm_platform_ioremap_resource(pdev, 2);
> > + if (IS_ERR(base)) {
> > if (has_acpi_companion(&pdev->dev))
> > dev_warn(&pdev->dev, "ACPI is too old, Flow control not supported\n");
> > else
> > dev_warn(&pdev->dev, "DT is too old, Flow control not supported\n");
> > - return 0;
> > - }
> > -
> > - base = devm_ioremap_resource(&pdev->dev, res);
> > - if (IS_ERR(base))
> > return PTR_ERR(base);
> > + }
>
> This is not equivalent. This means if ioremap() fails inside
> devm_platform_ioremap_resource(), we end up printing a message that
> blames the firmware, which is wrong.
>
> It also changes a "resource missing, proceed anyway" situation into
> a failure situation.
>
> Please drop this change, "cleaning" this up is introducing bugs.
Will do in v5.
>
> Thanks.
>
> --
> RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
> FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
Powered by blists - more mailing lists