aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2020-07-22 12:42:25 +0100
committerPeter Maydell <peter.maydell@linaro.org>2020-07-22 12:42:25 +0100
commitd0cc248164961a7ba9d43806feffd76f9f6d7f41 (patch)
tree9073d60dc8b5572ca9610a6d050e9df7c20a20ef /hw
parent3cbc8970f55c87cb58699b6dc8fe42998bc79dc0 (diff)
parent077195187b47d83418e5fb521c89d7881fab3049 (diff)
downloadqemu-d0cc248164961a7ba9d43806feffd76f9f6d7f41.zip
qemu-d0cc248164961a7ba9d43806feffd76f9f6d7f41.tar.gz
qemu-d0cc248164961a7ba9d43806feffd76f9f6d7f41.tar.bz2
Merge remote-tracking branch 'remotes/philmd-gitlab/tags/fw_cfg-20200721' into staging
fw_cfg patches Fixes the DEADCODE issue reported by Coverity (CID 1430396). CI jobs result: . https://gitlab.com/philmd/qemu/-/pipelines/169086301 # gpg: Signature made Tue 21 Jul 2020 18:52:46 BST # gpg: using RSA key FAABE75E12917221DCFD6BB2E3E32C2CDEADC0DE # gpg: Good signature from "Philippe Mathieu-Daudé (F4BUG) <f4bug@amsat.org>" [full] # Primary key fingerprint: FAAB E75E 1291 7221 DCFD 6BB2 E3E3 2C2C DEAD C0DE * remotes/philmd-gitlab/tags/fw_cfg-20200721: hw/nvram/fw_cfg: Let fw_cfg_add_from_generator() return boolean value hw/nvram/fw_cfg: Simplify fw_cfg_add_from_generator() error propagation Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw')
-rw-r--r--hw/nvram/fw_cfg.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c
index 3b1811d..f3a4728 100644
--- a/hw/nvram/fw_cfg.c
+++ b/hw/nvram/fw_cfg.c
@@ -1032,10 +1032,9 @@ void *fw_cfg_modify_file(FWCfgState *s, const char *filename,
return NULL;
}
-void fw_cfg_add_from_generator(FWCfgState *s, const char *filename,
+bool fw_cfg_add_from_generator(FWCfgState *s, const char *filename,
const char *gen_id, Error **errp)
{
- ERRP_GUARD();
FWCfgDataGeneratorClass *klass;
GByteArray *array;
Object *obj;
@@ -1044,20 +1043,22 @@ void fw_cfg_add_from_generator(FWCfgState *s, const char *filename,
obj = object_resolve_path_component(object_get_objects_root(), gen_id);
if (!obj) {
error_setg(errp, "Cannot find object ID '%s'", gen_id);
- return;
+ return false;
}
if (!object_dynamic_cast(obj, TYPE_FW_CFG_DATA_GENERATOR_INTERFACE)) {
error_setg(errp, "Object ID '%s' is not a '%s' subclass",
gen_id, TYPE_FW_CFG_DATA_GENERATOR_INTERFACE);
- return;
+ return false;
}
klass = FW_CFG_DATA_GENERATOR_GET_CLASS(obj);
array = klass->get_data(obj, errp);
- if (*errp) {
- return;
+ if (!array) {
+ return false;
}
size = array->len;
fw_cfg_add_file(s, filename, g_byte_array_free(array, TRUE), size);
+
+ return true;
}
static void fw_cfg_machine_reset(void *opaque)