From: Zheng Liu Date: Mon, 30 Nov 2015 01:21:57 +0000 (-0800) Subject: bcache: unregister reboot notifier if bcache fails to unregister device X-Git-Tag: v3.16.35~626 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e43ebd523e6ee590c6f8670fbf09257ffd6f6cb3;p=thirdparty%2Fkernel%2Fstable.git bcache: unregister reboot notifier if bcache fails to unregister device commit 2ecf0cdb2b437402110ab57546e02abfa68a716b upstream. In bcache_init() function it forgot to unregister reboot notifier if bcache fails to unregister a block device. This commit fixes this. Signed-off-by: Zheng Liu Tested-by: Joshua Schmid Tested-by: Eric Wheeler Cc: Kent Overstreet Signed-off-by: Jens Axboe Signed-off-by: Luis Henriques --- diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c index 4a53568799147..04506f7189e71 100644 --- a/drivers/md/bcache/super.c +++ b/drivers/md/bcache/super.c @@ -2087,8 +2087,10 @@ static int __init bcache_init(void) closure_debug_init(); bcache_major = register_blkdev(0, "bcache"); - if (bcache_major < 0) + if (bcache_major < 0) { + unregister_reboot_notifier(&reboot); return bcache_major; + } if (!(bcache_wq = create_workqueue("bcache")) || !(bcache_kobj = kobject_create_and_add("bcache", fs_kobj)) ||