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: NeilBrown <neilb@xxxxxxx> --- drivers/md/md.c | 2 ++ drivers/md/raid5.c | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/md/md.c b/drivers/md/md.c index d3c6020..cbe0f20 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -5339,6 +5339,8 @@ mdk_thread_t *md_register_thread(void (*run) (mddev_t *), mddev_t *mddev, void md_unregister_thread(mdk_thread_t *thread) { + if (! thread) + return; dprintk("interrupting MD-thread pid %d\n", task_pid_nr(thread->tsk)); kthread_stop(thread->tsk); diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index ee42d1a..6c33add 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -4451,8 +4451,7 @@ abort: kfree(conf->stripe_hashtbl); kfree(conf); } - if (mddev->thread) - md_unregister_thread(mddev->thread); + md_unregister_thread(mddev->thread); mddev->private = NULL; printk(KERN_ALERT "raid5: failed to run raid set %s\n", mdname(mddev)); return -EIO; -- To unsubscribe from this list: send the line "unsubscribe linux-raid" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html