am7xxx: don't use partial designated initializers
authorAntonio Ospite <ao2@ao2.it>
Thu, 8 May 2014 09:37:34 +0000 (11:37 +0200)
committerAntonio Ospite <ao2@ao2.it>
Thu, 8 May 2014 09:39:31 +0000 (11:39 +0200)
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.

src/am7xxx.c

index ffdd59c..7122658 100644 (file)
@@ -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;