[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL v2 35/35] nbd: assert that Error** is not NULL in nbd_iter_channel
From: |
Markus Armbruster |
Subject: |
[PULL v2 35/35] nbd: assert that Error** is not NULL in nbd_iter_channel_error |
Date: |
Wed, 18 Dec 2019 09:17:21 +0100 |
From: Vladimir Sementsov-Ogievskiy <address@hidden>
All callers of nbd_iter_channel_error() pass the address of a
local_err variable, and only call this function if an error has
already occurred, using this function to propagate that error.
This is already implied by its name (local_err instead of the classic
errp), but it is worth additionally stressing this by adding an
assertion to make it part of the function contract.
The local_err parameter is not here to return information about
nbd_iter_channel_error failure. Instead it's assumed to be filled when
passed to the function. This is already stressed by its name
(local_err, instead of classic errp). Stress it additionally by
assertion.
Signed-off-by: Vladimir Sementsov-Ogievskiy <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>
---
block/nbd.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/block/nbd.c b/block/nbd.c
index 5f18f78a94..d085554f21 100644
--- a/block/nbd.c
+++ b/block/nbd.c
@@ -866,6 +866,7 @@ typedef struct NBDReplyChunkIter {
static void nbd_iter_channel_error(NBDReplyChunkIter *iter,
int ret, Error **local_err)
{
+ assert(local_err && *local_err);
assert(ret < 0);
if (!iter->ret) {
--
2.21.0
- [PULL v2 22/35] 9pfs: make Error **errp const where it is appropriate, (continued)
- [PULL v2 22/35] 9pfs: make Error **errp const where it is appropriate, Markus Armbruster, 2019/12/18
- [PULL v2 13/35] hw/intc/s390: Simplify error handling in kvm_s390_flic_realize(), Markus Armbruster, 2019/12/18
- [PULL v2 30/35] hw/tpm: rename Error ** parameter to more common errp, Markus Armbruster, 2019/12/18
- [PULL v2 27/35] monitor/qmp-cmds: rename Error ** parameter to more common errp, Markus Armbruster, 2019/12/18
- [PULL v2 26/35] qga: rename Error ** parameter to more common errp, Markus Armbruster, 2019/12/18
- [PULL v2 16/35] error: make Error **errp const where it is appropriate, Markus Armbruster, 2019/12/18
- [PULL v2 23/35] hw/core/qdev: cleanup Error ** variables, Markus Armbruster, 2019/12/18
- [PULL v2 15/35] net/net: Clean up variable shadowing in net_client_init(), Markus Armbruster, 2019/12/18
- [PULL v2 31/35] hw/usb: rename Error ** parameter to more common errp, Markus Armbruster, 2019/12/18
- [PULL v2 24/35] block/snapshot: rename Error ** parameter to more common errp, Markus Armbruster, 2019/12/18
- [PULL v2 35/35] nbd: assert that Error** is not NULL in nbd_iter_channel_error,
Markus Armbruster <=
- [PULL v2 29/35] hw/sd: drop extra whitespace in sdhci_sysbus_realize() header, Markus Armbruster, 2019/12/18
- [PULL v2 32/35] include/qom/object.h: rename Error ** parameter to more common errp, Markus Armbruster, 2019/12/18
- [PULL v2 04/35] io: Fix Error usage in a comment <example>, Markus Armbruster, 2019/12/18
- [PULL v2 28/35] hw/s390x: rename Error ** parameter to more common errp, Markus Armbruster, 2019/12/18
- [PULL v2 33/35] backends/cryptodev: drop local_err from cryptodev_backend_complete(), Markus Armbruster, 2019/12/18
- [PULL v2 03/35] crypto: Fix typo in QCryptoTLSSession's <example> comment, Markus Armbruster, 2019/12/18
- [PULL v2 08/35] hw/core: Fix fit_load_fdt() error API violations, Markus Armbruster, 2019/12/18
- [PULL v2 12/35] error: Clean up unusual names of Error * variables, Markus Armbruster, 2019/12/18
- [PULL v2 17/35] hmp: drop Error pointer indirection in hmp_handle_error, Markus Armbruster, 2019/12/18
- [PULL v2 34/35] hw/vfio/ap: drop local_err from vfio_ap_realize, Markus Armbruster, 2019/12/18