Whamcloud - gitweb
LU-12764 lnet: eliminate uninitialized warning 89/36189/2
authorWang Shilong <wshilong@ddn.com>
Mon, 16 Sep 2019 01:55:58 +0000 (18:55 -0700)
committerOleg Drokin <green@whamcloud.com>
Fri, 4 Oct 2019 03:44:50 +0000 (03:44 +0000)
lustre-release/lnet/lnet/router.c: In function ‘lnet_del_route’:
include/linux/compiler.h:177:26: error: ‘lp’ may be used uninitialized
in this function [-Werror=maybe-uninitialized]
  case 8: *(__u64 *)res = *(volatile __u64 *)p; break;  \
/home/wangsl/lustre-release/lnet/lnet/router.c:754:20: note: ‘lp’ was declared here
  struct lnet_peer *lp;
/home/wangsl/lustre-release/lnet/lnet/router.c: At top level:
cc1: error: unrecognized command line option ‘-Wno-stringop-overflow’ [-Werror]
cc1: error: unrecognized command line option ‘-Wno-stringop-truncation’ [-Werror]
cc1: error: unrecognized command line option ‘-Wno-format-truncation’ [-Werror]
cc1: all warnings being treated as errors

codes logic gurantee @lpi and @lpni are inited at the same time,
but let's init @lpi to make gcc happy.

Change-Id: I1ccd88ca5061b5f29a530bf2b755585c92612a69
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Reviewed-on: https://review.whamcloud.com/36189
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Li Dongyang <dongyangli@ddn.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>

index 380f5ea..e5ac203 100644 (file)
@@ -754,7 +754,7 @@ lnet_del_route(__u32 net, lnet_nid_t gw_nid)
        struct lnet_peer_ni *lpni;
        struct lnet_route *route;
        struct list_head zombies;
-       struct lnet_peer *lp;
+       struct lnet_peer *lp = NULL;
        int i = 0;