aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEduardo Habkost <ehabkost@redhat.com>2017-06-08 10:39:03 -0300
committerMarkus Armbruster <armbru@redhat.com>2017-07-13 13:45:53 +0200
commit57ef3f1278585fbac5f6102362d3c5e066976fdc (patch)
tree9ad7b3ba80be868a6b6256586fa983ebb988c476
parenta9859c90a5db200fd4f63ab2cdc973343348b9ef (diff)
downloadqemu-57ef3f1278585fbac5f6102362d3c5e066976fdc.zip
qemu-57ef3f1278585fbac5f6102362d3c5e066976fdc.tar.gz
qemu-57ef3f1278585fbac5f6102362d3c5e066976fdc.tar.bz2
block: Don't try to set *errp directly
Assigning directly to *errp is not valid, as errp may be NULL, &error_fatal, or &error_abort. Use error_propagate() instead. With this, there's no need to check if errp is NULL anymore, as error_propagate() and error_prepend() are able to handle that. Cc: Kevin Wolf <kwolf@redhat.com> Cc: Max Reitz <mreitz@redhat.com> Cc: qemu-block@nongnu.org Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Message-Id: <20170608133906.12737-3-ehabkost@redhat.com> Reviewed-by: Alberto Garcia <berto@igalia.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
-rw-r--r--block.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/block.c b/block.c
index 6943962..b1599d2 100644
--- a/block.c
+++ b/block.c
@@ -4267,11 +4267,9 @@ bool bdrv_op_is_blocked(BlockDriverState *bs, BlockOpType op, Error **errp)
assert((int) op >= 0 && op < BLOCK_OP_TYPE_MAX);
if (!QLIST_EMPTY(&bs->op_blockers[op])) {
blocker = QLIST_FIRST(&bs->op_blockers[op]);
- if (errp) {
- *errp = error_copy(blocker->reason);
- error_prepend(errp, "Node '%s' is busy: ",
- bdrv_get_device_or_node_name(bs));
- }
+ error_propagate(errp, error_copy(blocker->reason));
+ error_prepend(errp, "Node '%s' is busy: ",
+ bdrv_get_device_or_node_name(bs));
return true;
}
return false;