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 <[email protected]>
Acked-by: Kuan-Wei Chiu <[email protected]> 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 >

