]> git.karo-electronics.de Git - linux-beck.git/commitdiff
rcutorture: Gracefully handle NULL cleanup hooks
authorPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Fri, 7 Feb 2014 22:42:51 +0000 (14:42 -0800)
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Sun, 23 Feb 2014 17:04:39 +0000 (09:04 -0800)
Although most torture tests will have some cleanup hook, it is possible
that one might not.  This commit therefore enables graceful handling of
a NULL cleanup hook during torture-test shutdown.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
kernel/torture.c

index b26c7b42becd3acc8dd81459dafa77f001177f4b..acc9afc2f26e4444f2cfbde9670e7d43ff3bced4 100644 (file)
@@ -454,7 +454,10 @@ static int torture_shutdown(void *arg)
 
        VERBOSE_TOROUT_STRING("torture_shutdown task shutting down system");
        shutdown_task = NULL;   /* Avoid self-kill deadlock. */
-       torture_shutdown_hook();/* Shut down the enclosing torture test. */
+       if (torture_shutdown_hook)
+               torture_shutdown_hook();
+       else
+               VERBOSE_TOROUT_STRING("No torture_shutdown_hook(), skipping.");
        kernel_power_off();     /* Shut down the system. */
        return 0;
 }