iwinfo: fix compilation error with GCC 12
authorChristian 'Ansuel' Marangi <ansuelsmth@gmail.com>
Thu, 19 May 2022 12:45:13 +0000 (14:45 +0200)
committerChristian 'Ansuel' Marangi <ansuelsmth@gmail.com>
Tue, 31 May 2022 17:44:26 +0000 (19:44 +0200)
Fix compilation error with GCC 12.

In file included from /home/ansuel/openwrt/staging_dir/target-aarch64_cortex-a53_musl/usr/include/libubus.h:23,
                 from iwinfo.c:21:
In function 'blobmsg_close_array',
    inlined from 'rpc_iwinfo_assoclist' at iwinfo.c:643:3:
/home/ansuel/openwrt/staging_dir/target-aarch64_cortex-a53_musl/usr/include/libubox/blobmsg.h:250:9: error: 'c' may be used uninitialized [-Werror=maybe-uninitialized]
  250 |         blob_nest_end(buf, cookie);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~
iwinfo.c: In function 'rpc_iwinfo_assoclist':
iwinfo.c:564:15: note: 'c' was declared here
  564 |         void *c, *d, *e;
      |               ^
cc1: all warnings being treated as errors
ninja: build stopped: subcommand failed.

Signed-off-by: Christian 'Ansuel' Marangi <ansuelsmth@gmail.com>
iwinfo.c

index 6c0319e5c7fe46b03dd7aebb15c31b7e0d694a02..38484c803a00f931eddd5a67a2e48dc4e9f16ea5 100644 (file)
--- a/iwinfo.c
+++ b/iwinfo.c
@@ -561,7 +561,7 @@ rpc_iwinfo_assoclist(struct ubus_context *ctx, struct ubus_object *obj,
        char res[IWINFO_BUFSIZE];
        struct iwinfo_assoclist_entry *a;
        struct ether_addr *macaddr = NULL;
-       void *c, *d, *e;
+       void *c = NULL, *d, *e;
        struct blob_attr *tb[__RPC_A_MAX];
        bool found = false;