From patchwork Wed Nov 9 19:34:28 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 5004 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id A29AA23E0D for ; Wed, 9 Nov 2011 19:34:34 +0000 (UTC) Received: from mail-fx0-f52.google.com (mail-fx0-f52.google.com [209.85.161.52]) by fiordland.canonical.com (Postfix) with ESMTP id 97327A1814A for ; Wed, 9 Nov 2011 19:34:34 +0000 (UTC) Received: by faan26 with SMTP id n26so2882575faa.11 for ; Wed, 09 Nov 2011 11:34:34 -0800 (PST) Received: by 10.152.109.199 with SMTP id hu7mr2543277lab.16.1320867274396; Wed, 09 Nov 2011 11:34:34 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.152.10.72 with SMTP id g8cs184006lab; Wed, 9 Nov 2011 11:34:34 -0800 (PST) Received: by 10.180.95.132 with SMTP id dk4mr4520708wib.30.1320867272926; Wed, 09 Nov 2011 11:34:32 -0800 (PST) Received: from mnementh.archaic.org.uk (mnementh.archaic.org.uk. [81.2.115.146]) by mx.google.com with ESMTPS id x5si3424627wiw.40.2011.11.09.11.34.32 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 09 Nov 2011 11:34:32 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 81.2.115.146 as permitted sender) client-ip=81.2.115.146; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 81.2.115.146 as permitted sender) smtp.mail=pm215@archaic.org.uk Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.72) (envelope-from ) id 1RODum-0002by-PH; Wed, 09 Nov 2011 19:34:28 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, qemu-trivial@nongnu.org Subject: [PATCH] hw/tc58128.c: Remove unnecessary check for g_malloc failure Date: Wed, 9 Nov 2011 19:34:28 +0000 Message-Id: <1320867268-10015-1-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.2.5 Remove a check for g_malloc failing: this never happens. Also use g_malloc rather than g_malloc0 as we immediately memset the entire region and so zero-initialising it is pointless. Spotted by Coverity (see bug 887883). Signed-off-by: Peter Maydell --- hw/tc58128.c | 6 +----- 1 files changed, 1 insertions(+), 5 deletions(-) diff --git a/hw/tc58128.c b/hw/tc58128.c index ee3ecad..4ce80b1 100644 --- a/hw/tc58128.c +++ b/hw/tc58128.c @@ -30,12 +30,8 @@ static void init_dev(tc58128_dev * dev, const char *filename) int ret, blocks; dev->state = WAIT; - dev->flash_contents = g_malloc0(FLASH_SIZE); + dev->flash_contents = g_malloc(FLASH_SIZE); memset(dev->flash_contents, 0xff, FLASH_SIZE); - if (!dev->flash_contents) { - fprintf(stderr, "could not alloc memory for flash\n"); - exit(1); - } if (filename) { /* Load flash image skipping the first block */ ret = load_image(filename, dev->flash_contents + 528 * 32);