hw/arm/boot: fix uninitialized scalar variable warning reported by coverity

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>
This commit is contained in:
zhanghailiang 2014-12-11 12:07:53 +00:00 committed by Peter Maydell
parent b1ab03af89
commit a554ecb49d

View 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, * Returns: the size of the device tree image on success,
* 0 if the image size exceeds the limit, * 0 if the image size exceeds the limit,
* -1 on errors. * -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, static int load_dtb(hwaddr addr, const struct arm_boot_info *binfo,
hwaddr addr_limit) hwaddr addr_limit)
@ -352,7 +354,7 @@ static int load_dtb(hwaddr addr, const struct arm_boot_info *binfo,
goto fail; goto fail;
} }
g_free(filename); g_free(filename);
} else if (binfo->get_dtb) { } else {
fdt = binfo->get_dtb(binfo, &size); fdt = binfo->get_dtb(binfo, &size);
if (!fdt) { if (!fdt) {
fprintf(stderr, "Board was unable to create a dtb blob\n"); fprintf(stderr, "Board was unable to create a dtb blob\n");