]> git.proxmox.com Git - mirror_qemu.git/commitdiff
hw/arm/boot: fix uninitialized scalar variable warning reported by coverity
authorzhanghailiang <zhang.zhanghailiang@huawei.com>
Thu, 11 Dec 2014 12:07:53 +0000 (12:07 +0000)
committerPeter Maydell <peter.maydell@linaro.org>
Thu, 11 Dec 2014 12:07:53 +0000 (12:07 +0000)
Coverity reports the 'size' may be used uninitialized, but that can't happen,
because the caller has checked "if (binfo->dtb_filename || binfo->get_dtb)"
before call 'load_dtb'.

Here we simply remove the 'if (binfo->get_dtb)' to satisfy coverity.

Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com>
Message-id: 1416826240-12368-1-git-send-email-zhang.zhanghailiang@huawei.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
hw/arm/boot.c

index 0014c34ddd1eb3b31e621c2d4e1f9c7494fd524a..e6a3c5bcfbc2f95af1a46f8ac3ef7fde9f5edd0c 100644 (file)
@@ -329,6 +329,8 @@ static void set_kernel_args_old(const struct arm_boot_info *info)
  * Returns: the size of the device tree image on success,
  *          0 if the image size exceeds the limit,
  *          -1 on errors.
+ *
+ * Note: Must not be called unless have_dtb(binfo) is true.
  */
 static int load_dtb(hwaddr addr, const struct arm_boot_info *binfo,
                     hwaddr addr_limit)
@@ -352,7 +354,7 @@ static int load_dtb(hwaddr addr, const struct arm_boot_info *binfo,
             goto fail;
         }
         g_free(filename);
-    } else if (binfo->get_dtb) {
+    } else {
         fdt = binfo->get_dtb(binfo, &size);
         if (!fdt) {
             fprintf(stderr, "Board was unable to create a dtb blob\n");