Skip to content

Commit

Permalink
rcutorture: Gracefully handle NULL cleanup hooks
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
paulmck committed Feb 23, 2014
1 parent 9dfa5b3 commit f881825
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion kernel/torture.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit f881825

Please sign in to comment.