qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH for-2.4] i.MX: Fix UART driver to work with unit


From: Peter Crosthwaite
Subject: Re: [Qemu-devel] [PATCH for-2.4] i.MX: Fix UART driver to work with unitialized "chardev" device
Date: Sat, 11 Jul 2015 02:00:40 -0700

On Thu, Jul 9, 2015 at 2:29 AM, Jean-Christophe Dubois
<address@hidden> wrote:
> The "chardev" property initialisation might failed (for example because
> there is not enough chardev handled by Qemu).
>
> The serial device emulator need to be able to "work" with an uninitialized
> (NULL) "chardev" device pointer.
>
> This patch add some test on the "chardev" pointer value before using it.
>

Grammar sweep:

The "chardev" property initialization might have failed (for example because
there are not enough chardevs provided by QEMU).

The serial device emulator need to be able to work with an uninitialized
(NULL) chardev device pointer.

This patch add some missing tests on the chr pointer value before
using it.

> Signed-off-by: Jean-Christophe Dubois <address@hidden>

I'm not sure if you need to respin on commit msg grammar of the the
committer just wants to take it.

Reviewed-by: Peter Crosthwaite <address@hidden>

Regards,
Peter

> ---
>  hw/char/imx_serial.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/hw/char/imx_serial.c b/hw/char/imx_serial.c
> index f3fbc77..383e50c 100644
> --- a/hw/char/imx_serial.c
> +++ b/hw/char/imx_serial.c
> @@ -203,7 +203,9 @@ static uint64_t imx_serial_read(void *opaque, hwaddr 
> offset,
>              s->usr2 &= ~USR2_RDR;
>              s->uts1 |= UTS1_RXEMPTY;
>              imx_update(s);
> -            qemu_chr_accept_input(s->chr);
> +            if (s->chr) {
> +                qemu_chr_accept_input(s->chr);
> +            }
>          }
>          return c;
>
> @@ -290,7 +292,9 @@ static void imx_serial_write(void *opaque, hwaddr offset,
>          }
>          if (value & UCR2_RXEN) {
>              if (!(s->ucr2 & UCR2_RXEN)) {
> -                qemu_chr_accept_input(s->chr);
> +                if (s->chr) {
> +                    qemu_chr_accept_input(s->chr);
> +                }
>              }
>          }
>          s->ucr2 = value & 0xffff;
> --
> 2.1.4
>
>



reply via email to

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