diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/iio/iio_generic_buffer.c | 4 | ||||
-rw-r--r-- | tools/lguest/lguest.c | 6 | ||||
-rw-r--r-- | tools/testing/radix-tree/Makefile | 2 | ||||
-rw-r--r-- | tools/testing/radix-tree/multiorder.c | 16 |
4 files changed, 18 insertions, 10 deletions
diff --git a/tools/iio/iio_generic_buffer.c b/tools/iio/iio_generic_buffer.c index 0e8a1f7a292d..f39c0e9c0d5c 100644 --- a/tools/iio/iio_generic_buffer.c +++ b/tools/iio/iio_generic_buffer.c | |||
@@ -348,7 +348,7 @@ int main(int argc, char **argv) | |||
348 | int notrigger = 0; | 348 | int notrigger = 0; |
349 | char *dummy; | 349 | char *dummy; |
350 | 350 | ||
351 | struct iio_channel_info *channels; | 351 | struct iio_channel_info *channels = NULL; |
352 | 352 | ||
353 | register_cleanup(); | 353 | register_cleanup(); |
354 | 354 | ||
@@ -456,7 +456,7 @@ int main(int argc, char **argv) | |||
456 | 456 | ||
457 | if (notrigger) { | 457 | if (notrigger) { |
458 | printf("trigger-less mode selected\n"); | 458 | printf("trigger-less mode selected\n"); |
459 | } if (trig_num >= 0) { | 459 | } else if (trig_num >= 0) { |
460 | char *trig_dev_name; | 460 | char *trig_dev_name; |
461 | ret = asprintf(&trig_dev_name, "%strigger%d", iio_dir, trig_num); | 461 | ret = asprintf(&trig_dev_name, "%strigger%d", iio_dir, trig_num); |
462 | if (ret < 0) { | 462 | if (ret < 0) { |
diff --git a/tools/lguest/lguest.c b/tools/lguest/lguest.c index d9836c5eb694..11c8d9bc762e 100644 --- a/tools/lguest/lguest.c +++ b/tools/lguest/lguest.c | |||
@@ -3266,6 +3266,9 @@ int main(int argc, char *argv[]) | |||
3266 | } | 3266 | } |
3267 | } | 3267 | } |
3268 | 3268 | ||
3269 | /* If we exit via err(), this kills all the threads, restores tty. */ | ||
3270 | atexit(cleanup_devices); | ||
3271 | |||
3269 | /* We always have a console device, and it's always device 1. */ | 3272 | /* We always have a console device, and it's always device 1. */ |
3270 | setup_console(); | 3273 | setup_console(); |
3271 | 3274 | ||
@@ -3369,9 +3372,6 @@ int main(int argc, char *argv[]) | |||
3369 | /* Ensure that we terminate if a device-servicing child dies. */ | 3372 | /* Ensure that we terminate if a device-servicing child dies. */ |
3370 | signal(SIGCHLD, kill_launcher); | 3373 | signal(SIGCHLD, kill_launcher); |
3371 | 3374 | ||
3372 | /* If we exit via err(), this kills all the threads, restores tty. */ | ||
3373 | atexit(cleanup_devices); | ||
3374 | |||
3375 | /* If requested, chroot to a directory */ | 3375 | /* If requested, chroot to a directory */ |
3376 | if (chroot_path) { | 3376 | if (chroot_path) { |
3377 | if (chroot(chroot_path) != 0) | 3377 | if (chroot(chroot_path) != 0) |
diff --git a/tools/testing/radix-tree/Makefile b/tools/testing/radix-tree/Makefile index 3b530467148e..9d0919ed52a4 100644 --- a/tools/testing/radix-tree/Makefile +++ b/tools/testing/radix-tree/Makefile | |||
@@ -1,5 +1,5 @@ | |||
1 | 1 | ||
2 | CFLAGS += -I. -g -Wall -D_LGPL_SOURCE | 2 | CFLAGS += -I. -g -O2 -Wall -D_LGPL_SOURCE |
3 | LDFLAGS += -lpthread -lurcu | 3 | LDFLAGS += -lpthread -lurcu |
4 | TARGETS = main | 4 | TARGETS = main |
5 | OFILES = main.o radix-tree.o linux.o test.o tag_check.o find_next_bit.o \ | 5 | OFILES = main.o radix-tree.o linux.o test.o tag_check.o find_next_bit.o \ |
diff --git a/tools/testing/radix-tree/multiorder.c b/tools/testing/radix-tree/multiorder.c index 39d9b9568fe2..05d7bc488971 100644 --- a/tools/testing/radix-tree/multiorder.c +++ b/tools/testing/radix-tree/multiorder.c | |||
@@ -124,6 +124,8 @@ static void multiorder_check(unsigned long index, int order) | |||
124 | unsigned long i; | 124 | unsigned long i; |
125 | unsigned long min = index & ~((1UL << order) - 1); | 125 | unsigned long min = index & ~((1UL << order) - 1); |
126 | unsigned long max = min + (1UL << order); | 126 | unsigned long max = min + (1UL << order); |
127 | void **slot; | ||
128 | struct item *item2 = item_create(min); | ||
127 | RADIX_TREE(tree, GFP_KERNEL); | 129 | RADIX_TREE(tree, GFP_KERNEL); |
128 | 130 | ||
129 | printf("Multiorder index %ld, order %d\n", index, order); | 131 | printf("Multiorder index %ld, order %d\n", index, order); |
@@ -139,13 +141,19 @@ static void multiorder_check(unsigned long index, int order) | |||
139 | item_check_absent(&tree, i); | 141 | item_check_absent(&tree, i); |
140 | for (i = max; i < 2*max; i++) | 142 | for (i = max; i < 2*max; i++) |
141 | item_check_absent(&tree, i); | 143 | item_check_absent(&tree, i); |
144 | for (i = min; i < max; i++) | ||
145 | assert(radix_tree_insert(&tree, i, item2) == -EEXIST); | ||
146 | |||
147 | slot = radix_tree_lookup_slot(&tree, index); | ||
148 | free(*slot); | ||
149 | radix_tree_replace_slot(slot, item2); | ||
142 | for (i = min; i < max; i++) { | 150 | for (i = min; i < max; i++) { |
143 | static void *entry = (void *) | 151 | struct item *item = item_lookup(&tree, i); |
144 | (0xA0 | RADIX_TREE_EXCEPTIONAL_ENTRY); | 152 | assert(item != 0); |
145 | assert(radix_tree_insert(&tree, i, entry) == -EEXIST); | 153 | assert(item->index == min); |
146 | } | 154 | } |
147 | 155 | ||
148 | assert(item_delete(&tree, index) != 0); | 156 | assert(item_delete(&tree, min) != 0); |
149 | 157 | ||
150 | for (i = 0; i < 2*max; i++) | 158 | for (i = 0; i < 2*max; i++) |
151 | item_check_absent(&tree, i); | 159 | item_check_absent(&tree, i); |