From a8fbaa1b998f558cdb196822447b2aafe8cf98b5 Mon Sep 17 00:00:00 2001 From: Wang Shilong Date: Sun, 15 Sep 2019 18:55:58 -0700 Subject: [PATCH] LU-12764 lnet: eliminate uninitialized warning MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 --- lnet/lnet/router.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); -- 1.8.3.1