[PATCH] drivers/md/raid6algos.c: fix a NULL dereference
authorAdrian Bunk <bunk@stusta.de>
Fri, 23 Jun 2006 09:05:59 +0000 (02:05 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Fri, 23 Jun 2006 14:43:08 +0000 (07:43 -0700)
This patch fixes a NULL dereference spotted by the Coverity checker.

Signed-off-by: Adrian Bunk <bunk@stusta.de>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Neil Brown <neilb@cse.unsw.edu.au>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/md/raid6algos.c

index 51c63c0cf1c9a8a52d680149d630c9c88613e5c6..926576156578b399ecd82e914c38bab94ae9bdd3 100644 (file)
@@ -139,15 +139,14 @@ int __init raid6_select_algo(void)
                }
        }
 
-       if ( best )
+       if (best) {
                printk("raid6: using algorithm %s (%ld MB/s)\n",
                       best->name,
                       (bestperf*HZ) >> (20-16+RAID6_TIME_JIFFIES_LG2));
-       else
+               raid6_call = *best;
+       } else
                printk("raid6: Yikes!  No algorithm found!\n");
 
-       raid6_call = *best;
-
        free_pages((unsigned long)syndromes, 1);
 
        return best ? 0 : -EINVAL;