public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: "Michal Suchánek" <msuchanek@suse.de>
To: Simon Glass <sjg@chromium.org>
Cc: "Marek Vasut" <marex@denx.de>,
	u-boot@lists.denx.de, "Jonas Karlman" <jonas@kwiboo.se>,
	"Pali Rohár" <pali@kernel.org>, "Bin Meng" <bmeng.cn@gmail.com>
Subject: Re: [PATCH] pci: Fix device_find_first_child() return value handling
Date: Thu, 27 Jul 2023 08:42:55 +0200	[thread overview]
Message-ID: <20230727064255.GN9196@kitsune.suse.cz> (raw)
In-Reply-To: <CAPnjgZ2X3b-c09xrhLXHccNd3TLQHHHJAUp66XB4B=Ff+_e_dg@mail.gmail.com>

Hello,

On Wed, Jul 26, 2023 at 06:49:57PM -0600, Simon Glass wrote:
> Hi Marek,
> 
> On Mon, 17 Jul 2023 at 11:03, Marek Vasut <marex@denx.de> wrote:
> >
> > On 7/17/23 09:42, Michal Suchánek wrote:
...
> > > More generally, what is the overall vision for these functions returning
> > > always zero?
> > >
> > > Should the return value be kept in case the underlying implementation
> > > changes and errors can happen in the future, and consequently checked?
> > >
> > > Should the return value be removed when meaningless making these
> > > useless assignments and checks an error?
> > >
> > > I already elimimnated a return value where using it lead to incorrect
> > > behavior but here using it or not is equally correct with the current
> > > implementation.
> >
> > Probably a question for Simon, really. Personally I would be tempted to
> > switch the function to return void.
> 
> So long as the function has its meaning documented, I think it is OK.
> As a separate patch, I am OK with changing
> device_find_first/next_child() to void, or alternatively having them
> return 0 on success and -ENODEV if nothing was found.

I think when there is one error condition having two ways to report it is
one too many.

Thanks

Michal

  reply	other threads:[~2023-07-27  6:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-16 15:53 [PATCH] pci: Fix device_find_first_child() return value handling Marek Vasut
2023-07-17  7:42 ` Michal Suchánek
2023-07-17 17:03   ` Marek Vasut
2023-07-27  0:49     ` Simon Glass
2023-07-27  6:42       ` Michal Suchánek [this message]
2023-08-15 14:42 ` Tom Rini

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=20230727064255.GN9196@kitsune.suse.cz \
    --to=msuchanek@suse.de \
    --cc=bmeng.cn@gmail.com \
    --cc=jonas@kwiboo.se \
    --cc=marex@denx.de \
    --cc=pali@kernel.org \
    --cc=sjg@chromium.org \
    --cc=u-boot@lists.denx.de \
    /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