From bf7a2ef2da781c209d5315d6505b1af2a5bfc6fa Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Fri, 9 Jan 2015 12:06:45 +0300 Subject: [PATCH] validation: silence some uninitialized variable warnings We're using uninitialized variables here and Smatch has started to catch on that that is bogus thing and complain about it. Shift things around so Smatch doesn't detect it. Signed-off-by: Dan Carpenter --- validation/sm_check_kunmap.c | 10 +++++----- validation/sm_dev_hold.c | 5 ++--- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/validation/sm_check_kunmap.c b/validation/sm_check_kunmap.c index a094c168..871f30c6 100644 --- a/validation/sm_check_kunmap.c +++ b/validation/sm_check_kunmap.c @@ -5,13 +5,13 @@ int kunmap(int p); int kmap_atomic(int p); int kunmap_atomic(int p); +int page; +int x; +int y; +int z; + void func(void) { - int page; - int x; - int y; - int z; - x = kmap(page); kunmap(page); kunmap(x); diff --git a/validation/sm_dev_hold.c b/validation/sm_dev_hold.c index 0d86ea1d..f69f70f3 100644 --- a/validation/sm_dev_hold.c +++ b/validation/sm_dev_hold.c @@ -3,11 +3,10 @@ void dev_hold(int *x); void dev_put(int *x){} extern int y,z; +int *x; int func (void) { - int *x; - dev_hold(x); if (y) { dev_put(x); @@ -23,6 +22,6 @@ int func (void) * check-command: smatch --project=kernel sm_dev_hold.c * * check-output-start -sm_dev_hold.c:17 func() warn: 'x' held on error path. +sm_dev_hold.c:16 func() warn: 'x' held on error path. * check-output-end */ -- 2.11.4.GIT