Commit e0cf8f04 authored by NeilBrown's avatar NeilBrown

md: md_unregister_thread should cope with being passed NULL

Mostly md_unregister_thread is only called when we know that the
thread is NULL, but sometimes we need to check first.  It is safer
to put the check inside md_unregister_thread itself.
Signed-off-by: default avatarNeilBrown <neilb@suse.de>
parent 91adb564
...@@ -5382,6 +5382,8 @@ mdk_thread_t *md_register_thread(void (*run) (mddev_t *), mddev_t *mddev, ...@@ -5382,6 +5382,8 @@ mdk_thread_t *md_register_thread(void (*run) (mddev_t *), mddev_t *mddev,
void md_unregister_thread(mdk_thread_t *thread) void md_unregister_thread(mdk_thread_t *thread)
{ {
if (!thread)
return;
dprintk("interrupting MD-thread pid %d\n", task_pid_nr(thread->tsk)); dprintk("interrupting MD-thread pid %d\n", task_pid_nr(thread->tsk));
kthread_stop(thread->tsk); kthread_stop(thread->tsk);
......
...@@ -4463,7 +4463,6 @@ static int run(mddev_t *mddev) ...@@ -4463,7 +4463,6 @@ static int run(mddev_t *mddev)
return 0; return 0;
abort: abort:
if (mddev->thread)
md_unregister_thread(mddev->thread); md_unregister_thread(mddev->thread);
mddev->thread = NULL; mddev->thread = NULL;
if (conf) { if (conf) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment