[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-commits] [qemu/qemu] a3ad58: hw/nvram/fw_cfg: Simplify fw_cfg_add_
From: |
Peter Maydell |
Subject: |
[Qemu-commits] [qemu/qemu] a3ad58: hw/nvram/fw_cfg: Simplify fw_cfg_add_from_generato... |
Date: |
Thu, 23 Jul 2020 03:45:29 -0700 |
Branch: refs/heads/master
Home: https://github.com/qemu/qemu
Commit: a3ad58342a9d88d1baafc0aee39302f79faad480
https://github.com/qemu/qemu/commit/a3ad58342a9d88d1baafc0aee39302f79faad480
Author: Philippe Mathieu-Daudé <philmd@redhat.com>
Date: 2020-07-21 (Tue, 21 Jul 2020)
Changed paths:
M hw/nvram/fw_cfg.c
M include/hw/nvram/fw_cfg.h
Log Message:
-----------
hw/nvram/fw_cfg: Simplify fw_cfg_add_from_generator() error propagation
Document FWCfgDataGeneratorClass::get_data() return NULL
on error, and non-NULL on success. This allow us to simplify
fw_cfg_add_from_generator(). Since we don't need a local
variable to propagate the error, we can remove the ERRP_GUARD()
macro.
Suggested-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20200721131911.27380-2-philmd@redhat.com>
Commit: 077195187b47d83418e5fb521c89d7881fab3049
https://github.com/qemu/qemu/commit/077195187b47d83418e5fb521c89d7881fab3049
Author: Philippe Mathieu-Daudé <philmd@redhat.com>
Date: 2020-07-21 (Tue, 21 Jul 2020)
Changed paths:
M hw/nvram/fw_cfg.c
M include/hw/nvram/fw_cfg.h
M softmmu/vl.c
Log Message:
-----------
hw/nvram/fw_cfg: Let fw_cfg_add_from_generator() return boolean value
Commits b6d7e9b66f..a43770df5d simplified the error propagation.
Similarly to commit 6fd5bef10b "qom: Make functions taking Error**
return bool, not void", let fw_cfg_add_from_generator() return a
boolean value, not void.
This allow to simplify parse_fw_cfg() and fixes the error handling
issue reported by Coverity (CID 1430396):
In parse_fw_cfg():
Variable assigned once to a constant guards dead code.
Local variable local_err is assigned only once, to a constant
value, making it effectively constant throughout its scope.
If this is not the intent, examine the logic to see if there
is a missing assignment that would make local_err not remain
constant.
It's the call of fw_cfg_add_from_generator():
Error *local_err = NULL;
fw_cfg_add_from_generator(fw_cfg, name, gen_id, errp);
if (local_err) {
error_propagate(errp, local_err);
return -1;
}
return 0;
If it fails, parse_fw_cfg() sets an error and returns 0, which is
wrong. Harmless, because the only caller passes &error_fatal.
Reported-by: Peter Maydell <peter.maydell@linaro.org>
Fixes: Coverity CID 1430396: 'Constant' variable guards dead code (DEADCODE)
Fixes: 6552d87c48 ("softmmu/vl: Let -fw_cfg option take a 'gen_id' argument")
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20200721131911.27380-3-philmd@redhat.com>
Commit: d0cc248164961a7ba9d43806feffd76f9f6d7f41
https://github.com/qemu/qemu/commit/d0cc248164961a7ba9d43806feffd76f9f6d7f41
Author: Peter Maydell <peter.maydell@linaro.org>
Date: 2020-07-22 (Wed, 22 Jul 2020)
Changed paths:
M hw/nvram/fw_cfg.c
M include/hw/nvram/fw_cfg.h
M softmmu/vl.c
Log Message:
-----------
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>
Compare: https://github.com/qemu/qemu/compare/3cbc8970f55c...d0cc24816496
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Qemu-commits] [qemu/qemu] a3ad58: hw/nvram/fw_cfg: Simplify fw_cfg_add_from_generato...,
Peter Maydell <=