linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael Walle <michael@walle.cc>
To: Vladimir Oltean <vladimir.oltean@nxp.com>
Cc: Claudiu Manoil <claudiu.manoil@nxp.com>,
	Alexandre Belloni <alexandre.belloni@bootlin.com>,
	Andrew Lunn <andrew@lunn.ch>,
	Vivien Didelot <vivien.didelot@gmail.com>,
	Florian Fainelli <f.fainelli@gmail.com>,
	"David S . Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	UNGLinuxDriver@microchip.com, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next] net: dsa: felix: suppress -EPROBE_DEFER errors
Date: Thu, 07 Apr 2022 16:25:16 +0200	[thread overview]
Message-ID: <30ea2ed5bcc7e9c97d132ea30a8dd774@walle.cc> (raw)
In-Reply-To: <20220407141254.3kpg75l4byytwfye@skbuf>

Am 2022-04-07 16:12, schrieb Vladimir Oltean:
> On Thu, Apr 07, 2022 at 04:04:20PM +0200, Michael Walle wrote:
>> Am 2022-04-07 15:56, schrieb Vladimir Oltean:
>> > On Thu, Apr 07, 2022 at 03:06:25PM +0200, Michael Walle wrote:
>> > > Due to missing prerequisites the probe of the felix switch might be
>> > > deferred:
>> > > [    4.435305] mscc_felix 0000:00:00.5: Failed to register DSA
>> > > switch: -517
>> > >
>> > > It's not an error. Use dev_err_probe() to demote the error to a debug
>> > > message. While at it, replace all the dev_err()'s in the probe with
>> > > dev_err_probe().
>> > >
>> > > Signed-off-by: Michael Walle <michael@walle.cc>
>> > > ---
>> >
>> > Please limit the dev_err_probe() to dsa_register_switch(). The resource
>> > that is missing is the DSA master, see of_find_net_device_by_node().
>> > The others cannot possibly return -EPROBE_DEFER.
>> 
>> This was my rationale (from the function doc):
>> 
>>  * Note that it is deemed acceptable to use this function for error
>>  * prints during probe even if the @err is known to never be 
>> -EPROBE_DEFER.
>>  * The benefit compared to a normal dev_err() is the standardized 
>> format
>>  * of the error code and the fact that the error code is returned.
>> 
>> In any case I don't have a strong opinion.
> 
> Take this case:
> 
>  		err = -ENOMEM;
> -		dev_err(&pdev->dev, "Failed to allocate driver memory\n");
> +		dev_err_probe(&pdev->dev, err, "Failed to allocate driver 
> memory\n");
> 
> (1) there is no need to print ENOMEM if we say "failed to allocate 
> memory"

That was actually a brain fart of mine ;) But AFAIK there is no need in
reporting ENOMEM errors anyway.

-michael

> (2) we don't use the return value of dev_err_probe() anyway, we have
>     actual teardown to do (pci_disable_device).
> (3) we _surely_ know that -ENOMEM != -EPROBE_DEFER
>> 
>> > >
>> > > Should this be a patch with a Fixes tag?
>> >
>> > Whichever way you wish, no preference.
>> 
>> I'll limit it to just the one dev_err() and add a Fixes,
>> there might be scripts out there who greps dmesg for errors.
> 
> Ok.

  reply	other threads:[~2022-04-07 14:26 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-07 13:06 [PATCH net-next] net: dsa: felix: suppress -EPROBE_DEFER errors Michael Walle
2022-04-07 13:56 ` Vladimir Oltean
2022-04-07 14:04   ` Michael Walle
2022-04-07 14:12     ` Vladimir Oltean
2022-04-07 14:25       ` Michael Walle [this message]
2022-04-07 14:58       ` Michael Walle
2022-04-08  2:56         ` Jakub Kicinski

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=30ea2ed5bcc7e9c97d132ea30a8dd774@walle.cc \
    --to=michael@walle.cc \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=andrew@lunn.ch \
    --cc=claudiu.manoil@nxp.com \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=vivien.didelot@gmail.com \
    --cc=vladimir.oltean@nxp.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).