qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 2/2] hw: aspeed: Init all UART's with serial devices


From: Peter Maydell
Subject: Re: [PATCH 2/2] hw: aspeed: Init all UART's with serial devices
Date: Mon, 16 May 2022 15:56:58 +0100

On Fri, 13 May 2022 at 22:09, Peter Delevoryas <pdel@fb.com> wrote

> I was actually intentionally skipping that. If serial_hd(i)
> doesn’t exist, the function will return NULL.
>
> Chardev *serial_hd(int i)
> {
>     assert(i >= 0);
>     if (i < num_serial_hds) {
>         return serial_hds[i];
>     }
>     return NULL;
> }
>
> So then, the serial device’s CharBackend’s “Chardev *chr”
> will be initialized as NULL. Looking at all of the
> usage of this attribute in “hw/char/serial.c”, I think
> that’s ok, the read/write functions will just be no-ops.
> They all have guards for “chr == NULL”.

Yes, this is deliberate. We added these in commit 12051d82f0040
because otherwise lots of board/SoC code would have to create
NullChardev dummy backends (or forget to and then crash depending
on the user's commandline).

thanks
-- PMM



reply via email to

[Prev in Thread] Current Thread [Next in Thread]