]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
md: md_unregister_thread should cope with being passed NULL
authorNeilBrown <neilb@suse.de>
Tue, 31 Mar 2009 03:39:39 +0000 (14:39 +1100)
committerNeilBrown <neilb@suse.de>
Tue, 31 Mar 2009 03:39:39 +0000 (14:39 +1100)
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@suse.de>
drivers/md/md.c
drivers/md/raid5.c

index 117ea5fde56824f86839339cd968c380509ff6cf..f30f09cb08e831bf0f7b50d09deae22e1c0c064d 100644 (file)
@@ -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)
 {
+       if (!thread)
+               return;
        dprintk("interrupting MD-thread pid %d\n", task_pid_nr(thread->tsk));
 
        kthread_stop(thread->tsk);
index d019a85547b453d0d1802f65ce9f1483fd7faaca..81789fa7a023368d83518ea6f80ffed570c83fbd 100644 (file)
@@ -4463,8 +4463,7 @@ static int run(mddev_t *mddev)
 
        return 0;
 abort:
-       if (mddev->thread)
-               md_unregister_thread(mddev->thread);
+       md_unregister_thread(mddev->thread);
        mddev->thread = NULL;
        if (conf) {
                shrink_stripes(conf);