diff options
author | Eduardo Habkost <ehabkost@redhat.com> | 2020-12-11 17:05:28 -0500 |
---|---|---|
committer | Eduardo Habkost <ehabkost@redhat.com> | 2020-12-18 15:20:18 -0500 |
commit | f405e3cdffe9d370867aeeef899863d619c32e26 (patch) | |
tree | d4c842ef2096b915a167264a22212637d968b4f5 /hw | |
parent | 1e198715e12ae86c4942a0a2d1df29beabccc295 (diff) |
qdev: Avoid unnecessary DeviceState* variable at set_prop_arraylen()
We're just doing pointer math with the device pointer, we can
simply use obj instead.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20201211220529.2290218-32-ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/core/qdev-properties.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index f3bbf05465..50f40949f5 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -559,10 +559,9 @@ static void set_prop_arraylen(Object *obj, Visitor *v, const char *name, * array-length field in the device struct, we have to create the * array itself and dynamically add the corresponding properties. */ - DeviceState *dev = DEVICE(obj); Property *prop = opaque; uint32_t *alenptr = object_field_prop_ptr(obj, prop); - void **arrayptr = (void *)dev + prop->arrayoffset; + void **arrayptr = (void *)obj + prop->arrayoffset; void *eltptr; const char *arrayname; int i; @@ -602,7 +601,7 @@ static void set_prop_arraylen(Object *obj, Visitor *v, const char *name, * they get the right answer despite the array element not actually * being inside the device struct. */ - arrayprop->prop.offset = eltptr - (void *)dev; + arrayprop->prop.offset = eltptr - (void *)obj; assert(object_field_prop_ptr(obj, &arrayprop->prop) == eltptr); object_property_add(obj, propname, arrayprop->prop.info->name, |