From a3ad58342a9d88d1baafc0aee39302f79faad480 Mon Sep 17 00:00:00 2001 From: Philippe Mathieu-Daudé Date: Tue, 21 Jul 2020 15:05:51 +0200 Subject: 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 Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Markus Armbruster Message-Id: <20200721131911.27380-2-philmd@redhat.com> --- include/hw/nvram/fw_cfg.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'include/hw/nvram') diff --git a/include/hw/nvram/fw_cfg.h b/include/hw/nvram/fw_cfg.h index 11feae3177..bbcf405649 100644 --- a/include/hw/nvram/fw_cfg.h +++ b/include/hw/nvram/fw_cfg.h @@ -32,7 +32,9 @@ typedef struct FWCfgDataGeneratorClass { * @obj: the object implementing this interface * @errp: pointer to a NULL-initialized error object * - * Returns: reference to a byte array containing the data. + * Returns: reference to a byte array containing the data on success, + * or NULL on error. + * * The caller should release the reference when no longer * required. */ -- cgit v1.2.3-55-g7522