Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

tools/virtio: virtio_test -h,--help should return directly

When we get help information, we should return directly, and we should not
execute test cases. Move the exit() directly into the help() function and
remove it from case '?'.

Signed-off-by: Rong Tao <rongtao@cestc.cn>
Message-Id: <tencent_822CEBEB925205EA1573541CD1C2604F4805@qq.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

authored by

Rong Tao and committed by
Michael S. Tsirkin
6b27cd84 9b2b3de6

+5 -5
+5 -5
tools/virtio/virtio_test.c
··· 327 327 } 328 328 }; 329 329 330 - static void help(void) 330 + static void help(int status) 331 331 { 332 332 fprintf(stderr, "Usage: virtio_test [--help]" 333 333 " [--no-indirect]" ··· 337 337 " [--batch=random/N]" 338 338 " [--reset=N]" 339 339 "\n"); 340 + 341 + exit(status); 340 342 } 341 343 342 344 int main(int argc, char **argv) ··· 356 354 case -1: 357 355 goto done; 358 356 case '?': 359 - help(); 360 - exit(2); 357 + help(2); 361 358 case 'e': 362 359 features &= ~(1ULL << VIRTIO_RING_F_EVENT_IDX); 363 360 break; 364 361 case 'h': 365 - help(); 366 - goto done; 362 + help(0); 367 363 case 'i': 368 364 features &= ~(1ULL << VIRTIO_RING_F_INDIRECT_DESC); 369 365 break;