diff mbox series

serial: ns16550: Correct the base address type

Message ID 1612358560-89527-1-git-send-email-bmeng.cn@gmail.com
State Accepted
Commit 09bd08401a5ff2cdbf40fdc27a8add809ae11075
Delegated to: Simon Glass
Headers show
Series serial: ns16550: Correct the base address type | expand

Commit Message

Bin Meng Feb. 3, 2021, 1:22 p.m. UTC
Currently ns16550_serial_assign_base() treats the argument 'base'
with type `ulong`. This is incorrect because the base address was
obtained from device tree with type `fdt_addr_t` that can represent
a physical address larger than 32-bit in a 32-bit system.

Fixes: 9e6ce62190b7 ("serial: ns16550: Fix ordering of getting base address")
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
---

 drivers/serial/ns16550.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Simon Glass Feb. 3, 2021, 9:42 p.m. UTC | #1
On Wed, 3 Feb 2021 at 06:22, Bin Meng <bmeng.cn@gmail.com> wrote:
>
> Currently ns16550_serial_assign_base() treats the argument 'base'
> with type `ulong`. This is incorrect because the base address was
> obtained from device tree with type `fdt_addr_t` that can represent
> a physical address larger than 32-bit in a 32-bit system.
>
> Fixes: 9e6ce62190b7 ("serial: ns16550: Fix ordering of getting base address")
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
> ---
>
>  drivers/serial/ns16550.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Simon Glass <sjg@chromium.org>
Simon Glass Feb. 7, 2021, 12:16 a.m. UTC | #2
On Wed, 3 Feb 2021 at 06:22, Bin Meng <bmeng.cn@gmail.com> wrote:
>
> Currently ns16550_serial_assign_base() treats the argument 'base'
> with type `ulong`. This is incorrect because the base address was
> obtained from device tree with type `fdt_addr_t` that can represent
> a physical address larger than 32-bit in a 32-bit system.
>
> Fixes: 9e6ce62190b7 ("serial: ns16550: Fix ordering of getting base address")
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
> ---
>
>  drivers/serial/ns16550.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Simon Glass <sjg@chromium.org>

Applied to u-boot-dm, thanks!
Bin Meng Feb. 26, 2021, 7:31 a.m. UTC | #3
Hi Simon,

On Sun, Feb 7, 2021 at 8:16 AM Simon Glass <sjg@chromium.org> wrote:
>
> On Wed, 3 Feb 2021 at 06:22, Bin Meng <bmeng.cn@gmail.com> wrote:
> >
> > Currently ns16550_serial_assign_base() treats the argument 'base'
> > with type `ulong`. This is incorrect because the base address was
> > obtained from device tree with type `fdt_addr_t` that can represent
> > a physical address larger than 32-bit in a 32-bit system.
> >
> > Fixes: 9e6ce62190b7 ("serial: ns16550: Fix ordering of getting base address")
> > Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
> > ---
> >
> >  drivers/serial/ns16550.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
>
> Reviewed-by: Simon Glass <sjg@chromium.org>
>
> Applied to u-boot-dm, thanks!

It looks like this is still not in u-boot/master yet?

Regards,
Bin
Simon Glass Feb. 26, 2021, 2:05 p.m. UTC | #4
Hi Bin,

On Fri, 26 Feb 2021 at 02:32, Bin Meng <bmeng.cn@gmail.com> wrote:
>
> Hi Simon,
>
> On Sun, Feb 7, 2021 at 8:16 AM Simon Glass <sjg@chromium.org> wrote:
> >
> > On Wed, 3 Feb 2021 at 06:22, Bin Meng <bmeng.cn@gmail.com> wrote:
> > >
> > > Currently ns16550_serial_assign_base() treats the argument 'base'
> > > with type `ulong`. This is incorrect because the base address was
> > > obtained from device tree with type `fdt_addr_t` that can represent
> > > a physical address larger than 32-bit in a 32-bit system.
> > >
> > > Fixes: 9e6ce62190b7 ("serial: ns16550: Fix ordering of getting base address")
> > > Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
> > > ---
> > >
> > >  drivers/serial/ns16550.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > Reviewed-by: Simon Glass <sjg@chromium.org>
> >
> > Applied to u-boot-dm, thanks!
>
> It looks like this is still not in u-boot/master yet?

Yes we hit a snag as Tom wants the  of-platdata stuff in -next
instead. I'll make a note to mess around with dm/master a bit and send
a pull request with just a few fixes, including this one.

Regards,
Simon
diff mbox series

Patch

diff --git a/drivers/serial/ns16550.c b/drivers/serial/ns16550.c
index 65c6db0..da903c1 100644
--- a/drivers/serial/ns16550.c
+++ b/drivers/serial/ns16550.c
@@ -482,7 +482,7 @@  static int ns16550_serial_getinfo(struct udevice *dev,
 	return 0;
 }
 
-static int ns16550_serial_assign_base(struct ns16550_plat *plat, ulong base)
+static int ns16550_serial_assign_base(struct ns16550_plat *plat, fdt_addr_t base)
 {
 	if (base == FDT_ADDR_T_NONE)
 		return -EINVAL;