]> git.proxmox.com Git - mirror_qemu.git/commitdiff
hw/tc58128.c: Remove unnecessary check for g_malloc failure
authorPeter Maydell <peter.maydell@linaro.org>
Wed, 9 Nov 2011 19:34:28 +0000 (19:34 +0000)
committerAnthony Liguori <aliguori@us.ibm.com>
Fri, 11 Nov 2011 18:49:53 +0000 (12:49 -0600)
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 <peter.maydell@linaro.org>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
hw/tc58128.c

index ee3ecad51abb014d347102e26d7dfb6c35129868..4ce80b18f3f6bc7fd618d64434673c52b1a9c825 100644 (file)
@@ -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);