From: Antonio Ospite Date: Thu, 8 May 2014 09:37:34 +0000 (+0200) Subject: am7xxx: don't use partial designated initializers X-Git-Tag: v0.1.5~8 X-Git-Url: https://git.ao2.it/libam7xxx.git/commitdiff_plain/701cb208fb160d2f14aff1b9cd425c481e2b003a?ds=inline am7xxx: don't use partial designated initializers Compilers may warn about missing fields in initializers when more checks are enabled with STRICT_COMPILATION_CHECKS=ON: .../src/am7xxx.c:1131:31: error: missing field 'direction' initializer [-Werror,-Wmissing-field-initializers] struct am7xxx_header h = { 0 }; ^ 1 error generated. --- diff --git a/src/am7xxx.c b/src/am7xxx.c index ffdd59c..7122658 100644 --- a/src/am7xxx.c +++ b/src/am7xxx.c @@ -1128,7 +1128,7 @@ AM7XXX_PUBLIC int am7xxx_get_device_info(am7xxx_device *dev, am7xxx_device_info *device_info) { int ret; - struct am7xxx_header h = { 0 }; + struct am7xxx_header h; if (dev->device_info) { memcpy(device_info, dev->device_info, sizeof(*device_info)); @@ -1139,6 +1139,7 @@ AM7XXX_PUBLIC int am7xxx_get_device_info(am7xxx_device *dev, if (ret < 0) return ret; + memset(&h, 0, sizeof(h)); ret = read_header(dev, &h); if (ret < 0) return ret;