Use error_is_set() only when necessary

error_is_set(&var) is the same as var != NULL, but it takes
whole-program analysis to figure that out.  Unnecessarily hard for
optimizers, static checkers, and human readers.  Dumb it down to
obvious.

Gets rid of several dozen Coverity false positives.

Note that the obvious form is already used in many places.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
This commit is contained in:
Markus Armbruster 2014-01-30 15:07:28 +01:00 committed by Luiz Capitulino
parent ff9ec34de8
commit 84d18f065f
37 changed files with 156 additions and 156 deletions

View file

@ -882,7 +882,7 @@ void net_host_device_add(Monitor *mon, const QDict *qdict)
qemu_opt_set(opts, "type", device);
net_client_init(opts, 0, &local_err);
if (error_is_set(&local_err)) {
if (local_err) {
qerror_report_err(local_err);
error_free(local_err);
monitor_printf(mon, "adding host network device %s failed\n", device);
@ -918,17 +918,17 @@ int qmp_netdev_add(Monitor *mon, const QDict *qdict, QObject **ret)
QemuOpts *opts;
opts_list = qemu_find_opts_err("netdev", &local_err);
if (error_is_set(&local_err)) {
if (local_err) {
goto exit_err;
}
opts = qemu_opts_from_qdict(opts_list, qdict, &local_err);
if (error_is_set(&local_err)) {
if (local_err) {
goto exit_err;
}
netdev_add(opts, &local_err);
if (error_is_set(&local_err)) {
if (local_err) {
qemu_opts_del(opts);
goto exit_err;
}
@ -1152,7 +1152,7 @@ static int net_init_client(QemuOpts *opts, void *dummy)
Error *local_err = NULL;
net_client_init(opts, 0, &local_err);
if (error_is_set(&local_err)) {
if (local_err) {
qerror_report_err(local_err);
error_free(local_err);
return -1;
@ -1167,7 +1167,7 @@ static int net_init_netdev(QemuOpts *opts, void *dummy)
int ret;
ret = net_client_init(opts, 1, &local_err);
if (error_is_set(&local_err)) {
if (local_err) {
qerror_report_err(local_err);
error_free(local_err);
return -1;