From: Kuan-Wei Chiu <visitorckw@gmail.com>
To: Naveen Kumar Chaudhary <naveen.osdev@gmail.com>
Cc: trini@konsulko.com, u-boot@lists.denx.de
Subject: Re: [PATCH] serial: goldfish: return error when device address is invalid
Date: Mon, 8 Jun 2026 23:26:44 +0800 [thread overview]
Message-ID: <aibfNE2DwYnh1B7j@google.com> (raw)
In-Reply-To: <vgwnt6mnls3lf3zdm6mz5siztzkvppte4ykszbvifjzukvmksf@maaxe5agqpim>
On Sun, Jun 07, 2026 at 09:15:42PM +0530, Naveen Kumar Chaudhary wrote:
> goldfish_serial_of_to_plat() returns success even when dev_read_addr()
> fails to find a valid address. This leaves plat->reg unset and defers
> the failure to probe().
>
> Return -EINVAL immediately when the address is FDT_ADDR_T_NONE so the
> failure is reported at the of_to_plat stage where it belongs.
>
> Signed-off-by: Naveen Kumar Chaudhary <naveen.osdev@gmail.com>
Acked-by: Kuan-Wei Chiu <visitorckw@gmail.com>
Thanks for the patch.
When I originally wrote this code, I assumed of_to_plat() would always
be called by the driver core regardless of the instantiation method.
After double-checking how the m68k virt instantiates the driver, I
realize it actually bypasses this function. Furthermore, there are
currently no in-tree users passing a device tree to this driver anyway.
Regards,
Kuan-Wei
> ---
> drivers/serial/serial_goldfish.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/serial/serial_goldfish.c b/drivers/serial/serial_goldfish.c
> index 91dc040fcf2..732f167caae 100644
> --- a/drivers/serial/serial_goldfish.c
> +++ b/drivers/serial/serial_goldfish.c
> @@ -74,8 +74,10 @@ static int goldfish_serial_of_to_plat(struct udevice *dev)
> fdt_addr_t addr;
>
> addr = dev_read_addr(dev);
> - if (addr != FDT_ADDR_T_NONE)
> - plat->reg = addr;
> + if (addr == FDT_ADDR_T_NONE)
> + return -EINVAL;
> +
> + plat->reg = addr;
>
> return 0;
> }
> --
> 2.43.0
>
prev parent reply other threads:[~2026-06-08 15:26 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-07 15:45 [PATCH] serial: goldfish: return error when device address is invalid Naveen Kumar Chaudhary
2026-06-08 15:26 ` Kuan-Wei Chiu [this message]
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=aibfNE2DwYnh1B7j@google.com \
--to=visitorckw@gmail.com \
--cc=naveen.osdev@gmail.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.