From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53761) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YG9qH-0004cC-C3 for qemu-devel@nongnu.org; Tue, 27 Jan 2015 12:22:22 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YG9qD-0000bW-9W for qemu-devel@nongnu.org; Tue, 27 Jan 2015 12:22:21 -0500 Received: from e06smtp10.uk.ibm.com ([195.75.94.106]:43853) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YG9qD-0000bH-0P for qemu-devel@nongnu.org; Tue, 27 Jan 2015 12:22:17 -0500 Received: from /spool/local by e06smtp10.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 27 Jan 2015 17:22:15 -0000 Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by d06dlp02.portsmouth.uk.ibm.com (Postfix) with ESMTP id B153D219005C for ; Tue, 27 Jan 2015 17:22:09 +0000 (GMT) Received: from d06av10.portsmouth.uk.ibm.com (d06av10.portsmouth.uk.ibm.com [9.149.37.251]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t0RHMC0s3539212 for ; Tue, 27 Jan 2015 17:22:12 GMT Received: from d06av10.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av10.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t0RHMCpm025754 for ; Tue, 27 Jan 2015 10:22:12 -0700 Date: Tue, 27 Jan 2015 18:22:10 +0100 From: Thomas Huth Message-ID: <20150127182210.08ae1e38@oc7435384737.ibm.com> In-Reply-To: <1422376711-31648-4-git-send-email-armbru@redhat.com> References: <1422376711-31648-1-git-send-email-armbru@redhat.com> <1422376711-31648-4-git-send-email-armbru@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 3/6] kvm: g_malloc() can't fail, bury dead error handling List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: qemu-trivial@redhat.com, qemu-devel@nongnu.org On Tue, 27 Jan 2015 17:38:28 +0100 Markus Armbruster wrote: > Signed-off-by: Markus Armbruster > --- > 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