From 82ee0c80e2fd59a19c34ea0c7614fa02a1633ea2 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Tue, 7 May 2013 13:15:54 +0100 Subject: [PATCH] testing: remove unused variables in comedi_test program Remove the global variable 'capabilities' which is set to 0 by the get_capabilities() function but not used anywhere else. Remove the 'type' and 'flags' local variables from get_capabilities() which are set to the return values of comedi_get_subdevice_type() and comedi_get_subdevice_flags() but never used. Remove the 'tmp' local variable from test_segfault(); it was involved in a volatile memory access to test for segmentation faults. Still do the volatile memory access but don't use the variable. --- testing/main.c | 13 ++----------- testing/mmap.c | 3 +-- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/testing/main.c b/testing/main.c index 839db21..aa9bb45 100644 --- a/testing/main.c +++ b/testing/main.c @@ -180,19 +180,10 @@ int main(int argc, char *argv[]) return 0; } -unsigned int capabilities; - static void get_capabilities(unsigned int subd) { - int type; - int flags; - - capabilities = 0; - - type = comedi_get_subdevice_type(device,subd); - - flags = comedi_get_subdevice_flags(device,subd); - + comedi_get_subdevice_type(device,subd); + comedi_get_subdevice_flags(device,subd); } static void print_device_info(void) diff --git a/testing/mmap.c b/testing/mmap.c index 780d879..0f9efd2 100644 --- a/testing/mmap.c +++ b/testing/mmap.c @@ -31,7 +31,6 @@ void segv_handler(int num) int test_segfault(void *memptr) { - volatile char tmp; int ret; struct sigaction act; struct sigaction oldact; @@ -45,7 +44,7 @@ int test_segfault(void *memptr) return 0; } ret=sigsetjmp(jump_env, 1); - if(!ret) tmp = *((char *)(memptr)); + if(!ret) *((volatile char *)(memptr)); sigaction(SIGSEGV,&oldact,NULL); return ret; }