QEMU-Devel Archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH for-2.4] i.MX: Fix UART driver to work with unitialized "chardev" device
@ 2015-07-09  9:29 Jean-Christophe Dubois
  2015-07-11  9:00 ` Peter Crosthwaite
  0 siblings, 1 reply; 4+ messages in thread
From: Jean-Christophe Dubois @ 2015-07-09  9:29 UTC (permalink / raw
  To: qemu-devel; +Cc: Jean-Christophe Dubois

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.

Signed-off-by: Jean-Christophe Dubois <jcd@tribudubois.net>
---
 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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH for-2.4] i.MX: Fix UART driver to work with unitialized "chardev" device
  2015-07-09  9:29 [Qemu-devel] [PATCH for-2.4] i.MX: Fix UART driver to work with unitialized "chardev" device Jean-Christophe Dubois
@ 2015-07-11  9:00 ` Peter Crosthwaite
  2015-07-13 21:14   ` Jean-Christophe DUBOIS
  0 siblings, 1 reply; 4+ messages in thread
From: Peter Crosthwaite @ 2015-07-11  9:00 UTC (permalink / raw
  To: Jean-Christophe Dubois; +Cc: qemu-devel@nongnu.org Developers

On Thu, Jul 9, 2015 at 2:29 AM, Jean-Christophe Dubois
<jcd@tribudubois.net> 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 <jcd@tribudubois.net>

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 <peter.crosthwaite@xilinx.com>

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
>
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH for-2.4] i.MX: Fix UART driver to work with unitialized "chardev" device
  2015-07-11  9:00 ` Peter Crosthwaite
@ 2015-07-13 21:14   ` Jean-Christophe DUBOIS
  2015-07-26 16:18     ` Jean-Christophe DUBOIS
  0 siblings, 1 reply; 4+ messages in thread
From: Jean-Christophe DUBOIS @ 2015-07-13 21:14 UTC (permalink / raw
  To: Peter Crosthwaite; +Cc: qemu-devel@nongnu.org Developers

Do you expect a v2 version of this patch that fix the patch description?

JC

Le 11/07/2015 11:00, Peter Crosthwaite a écrit :
> On Thu, Jul 9, 2015 at 2:29 AM, Jean-Christophe Dubois
> <jcd@tribudubois.net> 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 <jcd@tribudubois.net>
> 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 <peter.crosthwaite@xilinx.com>
>
> 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
>>
>>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH for-2.4] i.MX: Fix UART driver to work with unitialized "chardev" device
  2015-07-13 21:14   ` Jean-Christophe DUBOIS
@ 2015-07-26 16:18     ` Jean-Christophe DUBOIS
  0 siblings, 0 replies; 4+ messages in thread
From: Jean-Christophe DUBOIS @ 2015-07-26 16:18 UTC (permalink / raw
  To: qemu-devel@nongnu.org Developers; +Cc: Peter Crosthwaite

Hi,

Sorry to bother you but is there some more work needed on this simple patch?

Regards

JC

Le 13/07/2015 23:14, Jean-Christophe DUBOIS a écrit :
> Do you expect a v2 version of this patch that fix the patch description?
>
> JC
>
> Le 11/07/2015 11:00, Peter Crosthwaite a écrit :
>> On Thu, Jul 9, 2015 at 2:29 AM, Jean-Christophe Dubois
>> <jcd@tribudubois.net> 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 <jcd@tribudubois.net>
>> 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 <peter.crosthwaite@xilinx.com>
>>
>> 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
>>>
>>>
>
>
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-07-26 16:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-09  9:29 [Qemu-devel] [PATCH for-2.4] i.MX: Fix UART driver to work with unitialized "chardev" device Jean-Christophe Dubois
2015-07-11  9:00 ` Peter Crosthwaite
2015-07-13 21:14   ` Jean-Christophe DUBOIS
2015-07-26 16:18     ` Jean-Christophe DUBOIS

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).