diff options
author | Markus Armbruster <armbru@redhat.com> | 2020-07-07 18:06:00 +0200 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2020-07-10 15:18:08 +0200 |
commit | 0c0e618d233e3249f6b60678a1b013a2c8d83339 (patch) | |
tree | 792fe551574fb95cd28bc949d3780b9920e4629c /hw/scsi/scsi-bus.c | |
parent | 73ac1aac398576a30d3468abccbd9568adc1de76 (diff) | |
download | qemu-0c0e618d233e3249f6b60678a1b013a2c8d83339.zip qemu-0c0e618d233e3249f6b60678a1b013a2c8d83339.tar.gz qemu-0c0e618d233e3249f6b60678a1b013a2c8d83339.tar.bz2 |
qdev: Use returned bool to check for failure, Coccinelle part
The previous commit enables conversion of
qdev_prop_set_drive_err(..., &err);
if (err) {
...
}
to
if (!qdev_prop_set_drive_err(..., errp)) {
...
}
Coccinelle script:
@@
identifier fun = qdev_prop_set_drive_err;
expression list args;
typedef Error;
Error *err;
@@
- fun(args, &err);
- if (err)
+ if (!fun(args, &err))
{
...
}
One line break tidied up manually.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20200707160613.848843-33-armbru@redhat.com>
Diffstat (limited to 'hw/scsi/scsi-bus.c')
-rw-r--r-- | hw/scsi/scsi-bus.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c index a83939f..38b66a2 100644 --- a/hw/scsi/scsi-bus.c +++ b/hw/scsi/scsi-bus.c @@ -277,8 +277,7 @@ SCSIDevice *scsi_bus_legacy_add_drive(SCSIBus *bus, BlockBackend *blk, if (serial && object_property_find(OBJECT(dev), "serial", NULL)) { qdev_prop_set_string(dev, "serial", serial); } - qdev_prop_set_drive_err(dev, "drive", blk, &err); - if (err) { + if (!qdev_prop_set_drive_err(dev, "drive", blk, &err)) { error_propagate(errp, err); object_unparent(OBJECT(dev)); return NULL; |