diff options
author | Eduardo Habkost <ehabkost@redhat.com> | 2017-06-08 10:39:03 -0300 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2017-07-13 13:45:53 +0200 |
commit | 57ef3f1278585fbac5f6102362d3c5e066976fdc (patch) | |
tree | 9ad7b3ba80be868a6b6256586fa983ebb988c476 /block.c | |
parent | a9859c90a5db200fd4f63ab2cdc973343348b9ef (diff) |
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>
Diffstat (limited to 'block.c')
-rw-r--r-- | block.c | 8 |
1 files changed, 3 insertions, 5 deletions
@@ -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; |