netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: Rosen Penev <rosenp@gmail.com>
Cc: netdev@vger.kernel.org, "Kurt Kanzenbach" <kurt@linutronix.de>,
	"Andrew Lunn" <andrew@lunn.ch>,
	"Vladimir Oltean" <olteanv@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	"Eric Dumazet" <edumazet@google.com>,
	"Jakub Kicinski" <kuba@kernel.org>,
	"Paolo Abeni" <pabeni@redhat.com>,
	"Chris Snook" <chris.snook@gmail.com>,
	"Marcin Wojtas" <marcin.s.wojtas@gmail.com>,
	"Yoshihiro Shimoda" <yoshihiro.shimoda.uh@renesas.com>,
	"Niklas Söderlund" <niklas.soderlund@ragnatech.se>,
	"Richard Cochran" <richardcochran@gmail.com>,
	"open list" <linux-kernel@vger.kernel.org>,
	"open list:RENESAS ETHERNET SWITCH DRIVER"
	<linux-renesas-soc@vger.kernel.org>
Subject: Re: [PATCHv4 net-next] net: modernize ioremap in probe
Date: Tue, 3 Dec 2024 22:51:45 +0000	[thread overview]
Message-ID: <Z0-LgWETqKZe2uyV@shell.armlinux.org.uk> (raw)
In-Reply-To: <20241203222750.153272-1-rosenp@gmail.com>

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.

Thanks.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

  reply	other threads:[~2024-12-03 22:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-03 22:27 [PATCHv4 net-next] net: modernize ioremap in probe Rosen Penev
2024-12-03 22:51 ` Russell King (Oracle) [this message]
2024-12-03 23:43   ` Andrew Lunn
2024-12-04  1:30     ` Jakub Kicinski
2024-12-05  1:06   ` Rosen Penev

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=Z0-LgWETqKZe2uyV@shell.armlinux.org.uk \
    --to=linux@armlinux.org.uk \
    --cc=andrew@lunn.ch \
    --cc=chris.snook@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=kurt@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=marcin.s.wojtas@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=niklas.soderlund@ragnatech.se \
    --cc=olteanv@gmail.com \
    --cc=pabeni@redhat.com \
    --cc=richardcochran@gmail.com \
    --cc=rosenp@gmail.com \
    --cc=yoshihiro.shimoda.uh@renesas.com \
    /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;
as well as URLs for NNTP newsgroup(s).