From: Wang Shilong Date: Mon, 16 Sep 2019 01:55:58 +0000 (-0700) Subject: LU-12764 lnet: eliminate uninitialized warning X-Git-Tag: 2.12.90~47 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=a8fbaa1b998f558cdb196822447b2aafe8cf98b5 LU-12764 lnet: eliminate uninitialized warning 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 Reviewed-on: https://review.whamcloud.com/36189 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Li Dongyang Reviewed-by: Oleg Drokin --- diff --git a/lnet/lnet/router.c b/lnet/lnet/router.c index 380f5ea..e5ac203 100644 --- a/lnet/lnet/router.c +++ b/lnet/lnet/router.c @@ -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; INIT_LIST_HEAD(&rnet_zombies);