qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 3/6] kvm: g_malloc() can't fail, bury dead error


From: Thomas Huth
Subject: Re: [Qemu-devel] [PATCH 3/6] kvm: g_malloc() can't fail, bury dead error handling
Date: Tue, 27 Jan 2015 18:22:10 +0100

On Tue, 27 Jan 2015 17:38:28 +0100
Markus Armbruster <address@hidden> wrote:

> Signed-off-by: Markus Armbruster <address@hidden>
> ---
>  kvm-all.c | 4 ----
>  1 file changed, 4 deletions(-)
> 
> diff --git a/kvm-all.c b/kvm-all.c
> index 2f21a4e..05a79c2 100644
> --- a/kvm-all.c
> +++ b/kvm-all.c
> @@ -2070,10 +2070,6 @@ int kvm_insert_breakpoint(CPUState *cpu, target_ulong 
> addr,
>          }
> 
>          bp = g_malloc(sizeof(struct kvm_sw_breakpoint));
> -        if (!bp) {
> -            return -ENOMEM;
> -        }
> -
>          bp->pc = addr;
>          bp->use_count = 1;
>          err = kvm_arch_insert_sw_breakpoint(cpu, bp);

I think I'd also use g_try_malloc() here instead. Looks like an error
gets reported to GDB when this function returns with an error code, so
returning -ENOMEM should be ok here, shouldn't it?

 Thomas




reply via email to

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