diff mbox

[v3,10/46] ivshmem: remove last exit(1)

Message ID 1442333283-13119-11-git-send-email-marcandre.lureau@redhat.com
State New
Headers show

Commit Message

Marc-André Lureau Sept. 15, 2015, 4:07 p.m. UTC
From: Marc-André Lureau <marcandre.lureau@redhat.com>

Failing to create a chardev shouldn't be fatal.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 hw/misc/ivshmem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Claudio Fontana Sept. 22, 2015, 1:55 p.m. UTC | #1
On 15.09.2015 18:07, marcandre.lureau@redhat.com wrote:
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
> 
> Failing to create a chardev shouldn't be fatal.
> 
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>  hw/misc/ivshmem.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c
> index 3af73a5..7ba93c0 100644
> --- a/hw/misc/ivshmem.c
> +++ b/hw/misc/ivshmem.c
> @@ -299,7 +299,7 @@ static CharDriverState* create_eventfd_chr_device(void * opaque, EventNotifier *
>  
>      if (chr == NULL) {
>          error_report("creating eventfd for eventfd %d failed", eventfd);
> -        exit(1);
> +        return NULL;
>      }
>      qemu_chr_fe_claim_no_fail(chr);
>  
> 

I took a look at the eventfd_chr array in the IVShmemState,
and I noticed that it's allocated with malloc at some point for receiving interrupts
with g_malloc0 in pci_ivshmem_init, but it's never freed in pci_ivshmem_uninit.

Is there such a change somewhere in the patchset I have missed?

Have you checked that the resources allocated during pci_ivshmem_init are released on pci_ivshmem_uninit?

Ciao

Claudio
Claudio Fontana Sept. 22, 2015, 1:58 p.m. UTC | #2
On 22.09.2015 15:55, Claudio Fontana wrote:
> On 15.09.2015 18:07, marcandre.lureau@redhat.com wrote:
>> From: Marc-André Lureau <marcandre.lureau@redhat.com>
>>
>> Failing to create a chardev shouldn't be fatal.
>>
>> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
>> ---
>>  hw/misc/ivshmem.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c
>> index 3af73a5..7ba93c0 100644
>> --- a/hw/misc/ivshmem.c
>> +++ b/hw/misc/ivshmem.c
>> @@ -299,7 +299,7 @@ static CharDriverState* create_eventfd_chr_device(void * opaque, EventNotifier *
>>  
>>      if (chr == NULL) {
>>          error_report("creating eventfd for eventfd %d failed", eventfd);
>> -        exit(1);
>> +        return NULL;
>>      }
>>      qemu_chr_fe_claim_no_fail(chr);
>>  
>>
> 
> I took a look at the eventfd_chr array in the IVShmemState,
> and I noticed that it's allocated with malloc at some point for receiving interrupts
> with g_malloc0 in pci_ivshmem_init, but it's never freed in pci_ivshmem_uninit.
> 
> Is there such a change somewhere in the patchset I have missed?
> 
> Have you checked that the resources allocated during pci_ivshmem_init are released on pci_ivshmem_uninit?

With your patchset applied, that would be _realize and _exit,
as changed by patch

[PATCH v3 09/46] ivshmem: more qdev conversion

Ciao,CLaudio
Marc-Andre Lureau Sept. 22, 2015, 2 p.m. UTC | #3
Hi

----- Original Message -----
> On 15.09.2015 18:07, marcandre.lureau@redhat.com wrote:
> > From: Marc-André Lureau <marcandre.lureau@redhat.com>
> > 
> > Failing to create a chardev shouldn't be fatal.
> > 
> > Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> > ---
> >  hw/misc/ivshmem.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c
> > index 3af73a5..7ba93c0 100644
> > --- a/hw/misc/ivshmem.c
> > +++ b/hw/misc/ivshmem.c
> > @@ -299,7 +299,7 @@ static CharDriverState* create_eventfd_chr_device(void
> > * opaque, EventNotifier *
> >  
> >      if (chr == NULL) {
> >          error_report("creating eventfd for eventfd %d failed", eventfd);
> > -        exit(1);
> > +        return NULL;
> >      }
> >      qemu_chr_fe_claim_no_fail(chr);
> >  
> > 
> 
> I took a look at the eventfd_chr array in the IVShmemState,
> and I noticed that it's allocated with malloc at some point for receiving
> interrupts
> with g_malloc0 in pci_ivshmem_init, but it's never freed in
> pci_ivshmem_uninit.
> 
> Is there such a change somewhere in the patchset I have missed?
> 
> Have you checked that the resources allocated during pci_ivshmem_init are
> released on pci_ivshmem_uninit?

Yes, see other patches such as "ivshmem: more qdev conversion" & "ivshmem: fix pci_ivshmem_exit()"

thanks
diff mbox

Patch

diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c
index 3af73a5..7ba93c0 100644
--- a/hw/misc/ivshmem.c
+++ b/hw/misc/ivshmem.c
@@ -299,7 +299,7 @@  static CharDriverState* create_eventfd_chr_device(void * opaque, EventNotifier *
 
     if (chr == NULL) {
         error_report("creating eventfd for eventfd %d failed", eventfd);
-        exit(1);
+        return NULL;
     }
     qemu_chr_fe_claim_no_fail(chr);