Skip to contentSkip to conversation

virtio: Drop broken and superfluous object_property_set_link()

PATCH In review Markus Armbruster 3 participants 4 messages Jul 21, 2020 – Jul 23, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 virtio: Drop broken and superfluous object_property_set_link()

virtio_crypto_pci_realize() and copies the value of vcrypto->vdev's property "cryptodev" to vcrypto's property:

    object_property_set_link(OBJECT(vrng), "rng", OBJECT(vrng->vdev.conf.rng),
                             NULL);

Since it does so only after realize, this always fails, but the error is ignored.

It's actually superfluous: vcrypto's property is an alias of vcrypto->vdev's property, created by virtio_instance_init_common().

Drop the call.

Same for virtio_ccw_crypto_realize(), virtio_rng_pci_realize(), virtio_ccw_rng_realize().

---
 hw/s390x/virtio-ccw-crypto.c  | 3 ---
 hw/s390x/virtio-ccw-rng.c     | 3 ---
 hw/virtio/virtio-crypto-pci.c | 2 --
 hw/virtio/virtio-rng-pci.c    | 3 ---
 4 files changed, 11 deletions(-)
hw/s390x/virtio-ccw-crypto.c +0 -3
index 570c0333fc..358c74fb4b 100644
@@ -23,9 +23,6 @@ static void virtio_ccw_crypto_realize(VirtioCcwDevice *ccw_dev, Error **errp)
     if (!qdev_realize(vdev, BUS(&ccw_dev->bus), errp)) {
         return;
     }
-
-    object_property_set_link(OBJECT(vdev), "cryptodev",
-                             OBJECT(dev->vdev.conf.cryptodev), NULL);
 }
 
 static void virtio_ccw_crypto_instance_init(Object *obj)
hw/s390x/virtio-ccw-rng.c +0 -3
index 4bb8c16d79..2e3a9da5e8 100644
@@ -24,9 +24,6 @@ static void virtio_ccw_rng_realize(VirtioCcwDevice *ccw_dev, Error **errp)
     if (!qdev_realize(vdev, BUS(&ccw_dev->bus), errp)) {
         return;
     }
-
-    object_property_set_link(OBJECT(dev), "rng", OBJECT(dev->vdev.conf.rng),
-                             NULL);
 }
 
 static void virtio_ccw_rng_instance_init(Object *obj)
hw/virtio/virtio-crypto-pci.c +0 -2
index f1cc979d33..198f86e08c 100644
@@ -57,8 +57,6 @@ static void virtio_crypto_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp)
     if (!qdev_realize(vdev, BUS(&vpci_dev->bus), errp)) {
         return;
     }
-    object_property_set_link(OBJECT(vcrypto), "cryptodev",
-                             OBJECT(vcrypto->vdev.conf.cryptodev), NULL);
 }
 
 static void virtio_crypto_pci_class_init(ObjectClass *klass, void *data)
hw/virtio/virtio-rng-pci.c +0 -3
index 2f0b529b62..8afbb4c209 100644
@@ -38,9 +38,6 @@ static void virtio_rng_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp)
     if (!qdev_realize(vdev, BUS(&vpci_dev->bus), errp)) {
         return;
     }
-
-    object_property_set_link(OBJECT(vrng), "rng", OBJECT(vrng->vdev.conf.rng),
-                             NULL);
 }
 
 static void virtio_rng_pci_class_init(ObjectClass *klass, void *data)
Signature · 1 line
2.26.2
#1 lore raw

On 7/21/20 2:11 PM, Markus Armbruster wrote:

Is there a line missing here?

Quoted 1 line

virtio_crypto_pci_realize() and copies the value of vcrypto->vdev's

                              ^^^
Quoted 80 lines

property "cryptodev" to vcrypto's property:

    object_property_set_link(OBJECT(vrng), "rng", OBJECT(vrng->vdev.conf.rng),
                             NULL);

Since it does so only after realize, this always fails, but the error is ignored.

It's actually superfluous: vcrypto's property is an alias of vcrypto->vdev's property, created by virtio_instance_init_common().

Drop the call.

Same for virtio_ccw_crypto_realize(), virtio_rng_pci_realize(), virtio_ccw_rng_realize().

---
 hw/s390x/virtio-ccw-crypto.c  | 3 ---
 hw/s390x/virtio-ccw-rng.c     | 3 ---
 hw/virtio/virtio-crypto-pci.c | 2 --
 hw/virtio/virtio-rng-pci.c    | 3 ---
 4 files changed, 11 deletions(-)
hw/s390x/virtio-ccw-crypto.c +0 -3
index 570c0333fc..358c74fb4b 100644
@@ -23,9 +23,6 @@ static void virtio_ccw_crypto_realize(VirtioCcwDevice *ccw_dev, Error **errp)
     if (!qdev_realize(vdev, BUS(&ccw_dev->bus), errp)) {
         return;
     }
-
-    object_property_set_link(OBJECT(vdev), "cryptodev",
-                             OBJECT(dev->vdev.conf.cryptodev), NULL);
 }
 
 static void virtio_ccw_crypto_instance_init(Object *obj)
hw/s390x/virtio-ccw-rng.c +0 -3
index 4bb8c16d79..2e3a9da5e8 100644
@@ -24,9 +24,6 @@ static void virtio_ccw_rng_realize(VirtioCcwDevice *ccw_dev, Error **errp)
     if (!qdev_realize(vdev, BUS(&ccw_dev->bus), errp)) {
         return;
     }
-
-    object_property_set_link(OBJECT(dev), "rng", OBJECT(dev->vdev.conf.rng),
-                             NULL);
 }
 
 static void virtio_ccw_rng_instance_init(Object *obj)
hw/virtio/virtio-crypto-pci.c +0 -2
index f1cc979d33..198f86e08c 100644
@@ -57,8 +57,6 @@ static void virtio_crypto_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp)
     if (!qdev_realize(vdev, BUS(&vpci_dev->bus), errp)) {
         return;
     }
-    object_property_set_link(OBJECT(vcrypto), "cryptodev",
-                             OBJECT(vcrypto->vdev.conf.cryptodev), NULL);
 }
 
 static void virtio_crypto_pci_class_init(ObjectClass *klass, void *data)
hw/virtio/virtio-rng-pci.c +0 -3
index 2f0b529b62..8afbb4c209 100644
@@ -38,9 +38,6 @@ static void virtio_rng_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp)
     if (!qdev_realize(vdev, BUS(&vpci_dev->bus), errp)) {
         return;
     }
-
-    object_property_set_link(OBJECT(vrng), "rng", OBJECT(vrng->vdev.conf.rng),
-                             NULL);
 }
 
 static void virtio_rng_pci_class_init(ObjectClass *klass, void *data)
#2 lore raw
Quoted 8 lines · Philippe Mathieu-Daudé

On 7/21/20 2:11 PM, Markus Armbruster wrote:

Is there a line missing here?

Quoted 1 line

virtio_crypto_pci_realize() and copies the value of vcrypto->vdev's

                              ^^^

Scratch "and". I started describing two of the four cases together, then changed my mind and described just one, keeping other three under "Same for" below. I accidentally left the "and" behind.

Quoted 17 lines
Quoted 17 lines

property "cryptodev" to vcrypto's property:

    object_property_set_link(OBJECT(vrng), "rng", OBJECT(vrng->vdev.conf.rng),
                             NULL);

Since it does so only after realize, this always fails, but the error is ignored.

It's actually superfluous: vcrypto's property is an alias of vcrypto->vdev's property, created by virtio_instance_init_common().

Drop the call.

Same for virtio_ccw_crypto_realize(), virtio_rng_pci_realize(), virtio_ccw_rng_realize().

Reviewed-by on v1 1/1
#3 lore raw
In reply to Markus Armbruster
Quoted 17 lines · On Tue, 21 Jul 2020 14:11:53 +0200 Markus Armbruster <[email protected]> wrote:

virtio_crypto_pci_realize() and copies the value of vcrypto->vdev's property "cryptodev" to vcrypto's property:

    object_property_set_link(OBJECT(vrng), "rng", OBJECT(vrng->vdev.conf.rng),
                             NULL);

Since it does so only after realize, this always fails, but the error is ignored.

It's actually superfluous: vcrypto's property is an alias of vcrypto->vdev's property, created by virtio_instance_init_common().

Drop the call.

Same for virtio_ccw_crypto_realize(), virtio_rng_pci_realize(), virtio_ccw_rng_realize().

Quoted 7 lines
---
 hw/s390x/virtio-ccw-crypto.c  | 3 ---
 hw/s390x/virtio-ccw-rng.c     | 3 ---
 hw/virtio/virtio-crypto-pci.c | 2 --
 hw/virtio/virtio-rng-pci.c    | 3 ---
 4 files changed, 11 deletions(-)