From d9a7b125d6b8048a503d10117ee8b7cbc44cc889 Mon Sep 17 00:00:00 2001 From: Peter Maydell Date: Mon, 17 Jul 2017 13:36:06 +0100 Subject: [PATCH] qdev-properties.h: Explicitly set the default value for arraylen properties MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In DEFINE_PROP_ARRAY, because we use a PropertyInfo (qdev_prop_arraylen) which has a .set_default_value member we will set the field to a default value. That default value will be zero, by the C rule that struct initialization sets unmentioned members to zero if at least one member is initialized. However it's clearer to state it explicitly. Signed-off-by: Peter Maydell Reviewed-by: Marc-André Lureau Message-id: 1499788408-10096-2-git-send-email-peter.maydell@linaro.org --- include/hw/qdev-properties.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h index f6692d5dc3..12c0c7b1f6 100644 --- a/include/hw/qdev-properties.h +++ b/include/hw/qdev-properties.h @@ -111,6 +111,7 @@ extern const PropertyInfo qdev_prop_link; _arrayfield, _arrayprop, _arraytype) { \ .name = (PROP_ARRAY_LEN_PREFIX _name), \ .info = &(qdev_prop_arraylen), \ + .defval.u = 0, \ .offset = offsetof(_state, _field) \ + type_check(uint32_t, typeof_field(_state, _field)), \ .arrayinfo = &(_arrayprop), \