From: Randy Dunlap Date: Fri, 29 Sep 2006 08:58:56 +0000 (-0700) Subject: [PATCH] block: handle subsystem_register() init errors X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=87a57261105669d13a9cae747b5b67ca1cbcda3c;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git [PATCH] block: handle subsystem_register() init errors Check and handle init errors. Signed-off-by: Randy Dunlap Cc: Greg KH Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/block/genhd.c b/block/genhd.c index 25d1f42568cc..653919d50cd4 100644 --- a/block/genhd.c +++ b/block/genhd.c @@ -295,10 +295,15 @@ static struct kobject *base_probe(dev_t dev, int *part, void *data) static int __init genhd_device_init(void) { + int err; + bdev_map = kobj_map_init(base_probe, &block_subsys_lock); blk_dev_init(); - subsystem_register(&block_subsys); - return 0; + err = subsystem_register(&block_subsys); + if (err < 0) + printk(KERN_WARNING "%s: subsystem_register error: %d\n", + __FUNCTION__, err); + return err; } subsys_initcall(genhd_device_init);