From 57ef3f1278585fbac5f6102362d3c5e066976fdc Mon Sep 17 00:00:00 2001 From: Eduardo Habkost Date: Thu, 8 Jun 2017 10:39:03 -0300 Subject: 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 Cc: Max Reitz Cc: qemu-block@nongnu.org Signed-off-by: Eduardo Habkost Message-Id: <20170608133906.12737-3-ehabkost@redhat.com> Reviewed-by: Alberto Garcia Reviewed-by: Eric Blake Reviewed-by: Markus Armbruster Signed-off-by: Markus Armbruster --- block.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'block.c') diff --git a/block.c b/block.c index 694396281b..b1599d26db 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; -- cgit v1.2.3