From: "Markus Schneider-Pargmann" <msp@baylibre.com>
To: "Simon Glass" <sjg@chromium.org>,
"Markus Schneider-Pargmann (TI.com)" <msp@baylibre.com>
Cc: <u-boot@lists.denx.de>,
"Mattijs Korpershoek" <mkorpershoek@kernel.org>,
"Tom Rini" <trini@konsulko.com>, "Marek Vasut" <marex@denx.de>,
"Andrew Goodbody" <andrew.goodbody@linaro.org>,
"Kory Maincent" <kory.maincent@bootlin.com>,
"Svyatoslav Ryhel" <clamor95@gmail.com>,
"Christian Marangi" <ansuelsmth@gmail.com>,
"Dinesh Maniyam" <dinesh.maniyam@altera.com>,
"Heiko Schocher" <hs@nabladev.com>
Subject: Re: [PATCH v2 2/6] dm: core: lists_bind_fdt: Replace found variable
Date: Mon, 12 Jan 2026 10:31:03 +0100 [thread overview]
Message-ID: <DFMI8576QX69.WDXJM34H19Q6@baylibre.com> (raw)
In-Reply-To: <CAFLszTiNU=2cJTkB2c8d4NrFZ7K0KR7LQnPYO0TWzX_BuBrUFw@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 2283 bytes --]
Hi Simon,
On Fri Jan 9, 2026 at 12:32 PM CET, Simon Glass wrote:
> Hi Markus,
>
> On Thu, 8 Jan 2026 at 04:17, Markus Schneider-Pargmann (TI.com)
> <msp@baylibre.com> wrote:
>>
>> 'found' is only used at the end of the function to print a debug
>> message. No need to maintain a variable if we can just return 0
>> immediately when a driver was bound successfully.
>>
>> Signed-off-by: Markus Schneider-Pargmann (TI.com) <msp@baylibre.com>
>> ---
>> drivers/core/lists.c | 5 ++---
>> 1 file changed, 2 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/core/lists.c b/drivers/core/lists.c
>> index 52ba6c7bfa007b660b854de62c97ad3c1761f1a5..9d1ca38212ee7f53b8894f964f096611c8ec20a5 100644
>> --- a/drivers/core/lists.c
>> +++ b/drivers/core/lists.c
>> @@ -204,7 +204,6 @@ int lists_bind_fdt(struct udevice *parent, ofnode node, struct udevice **devp,
>> const struct udevice_id *id;
>> struct driver *entry;
>> struct udevice *dev;
>> - bool found = false;
>> const char *name, *compat_list, *compat;
>> int compat_length, i;
>> int ret = 0;
>> @@ -275,14 +274,14 @@ int lists_bind_fdt(struct udevice *parent, ofnode node, struct udevice **devp,
>> ret);
>> return log_msg_ret("bind", ret);
>> } else {
>> - found = true;
>> if (devp)
>> *devp = dev;
>> + return 0;
>> }
>> break;
>> }
>>
>> - if (!found && ret != -ENODEV)
>> + if (ret != -ENODEV)
>> log_debug("No match for node '%s'\n", name);
>>
>> return 0;
>>
>> --
>> 2.51.0
>>
>
> I like to have a single successful return at the end of each function
> so that it is easier to follow what is going on. But since you wrote
> this patch:
>
> Reviewed-by: Simon Glass <simon.glass@canonical.com>
Thanks for reviewing. If you prefer I can redesign this as well. But
also note that the function already has two early return 0. One if the
device does not have a compatible list and the other for pre_reloc_only
if pre-relocation is skipped.
Best
Markus
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 289 bytes --]
next prev parent reply other threads:[~2026-01-12 13:11 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-08 11:16 [PATCH v2 0/6] dm: core: Support same compatible in host/gadget musb drivers Markus Schneider-Pargmann (TI.com)
2026-01-08 11:16 ` [PATCH v2 1/6] dm: core: lists_bind_fdt: Remove unused variable Markus Schneider-Pargmann (TI.com)
2026-01-09 11:32 ` Simon Glass
2026-01-08 11:16 ` [PATCH v2 2/6] dm: core: lists_bind_fdt: Replace found variable Markus Schneider-Pargmann (TI.com)
2026-01-09 11:32 ` Simon Glass
2026-01-12 9:31 ` Markus Schneider-Pargmann [this message]
2026-01-08 11:16 ` [PATCH v2 3/6] dm: core: Support multiple drivers with same compatibles Markus Schneider-Pargmann (TI.com)
2026-01-09 11:36 ` Simon Glass
2026-01-12 9:41 ` Markus Schneider-Pargmann
2026-01-08 11:16 ` [PATCH v2 4/6] test: dm: Add compatible multimatch test Markus Schneider-Pargmann (TI.com)
2026-01-09 11:32 ` Simon Glass
2026-01-12 9:48 ` Markus Schneider-Pargmann
2026-01-08 11:16 ` [PATCH v2 5/6] usb: musb-new: Relative ctrl_mod address parsing Markus Schneider-Pargmann (TI.com)
2026-01-08 11:16 ` [PATCH v2 6/6] usb: musb-new: Add compatibles for ti,musb-am33xx Markus Schneider-Pargmann (TI.com)
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=DFMI8576QX69.WDXJM34H19Q6@baylibre.com \
--to=msp@baylibre.com \
--cc=andrew.goodbody@linaro.org \
--cc=ansuelsmth@gmail.com \
--cc=clamor95@gmail.com \
--cc=dinesh.maniyam@altera.com \
--cc=hs@nabladev.com \
--cc=kory.maincent@bootlin.com \
--cc=marex@denx.de \
--cc=mkorpershoek@kernel.org \
--cc=sjg@chromium.org \
--cc=trini@konsulko.com \
--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