From: Anton Blanchard Date: Tue, 6 Apr 2010 21:34:55 +0000 (-0700) Subject: devmem: handle class_create() failure X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=6e191f7bb083544dc4fa3879ff81caf97c65d197;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git devmem: handle class_create() failure I hit this when we had a bug in IDR for a few days. Basically sysfs would fail to create new inodes since it uses an IDR and therefore class_create would fail. While we are unlikely to see this fail we may as well handle it instead of oopsing. Signed-off-by: Anton Blanchard Reviewed-by: Wu Fengguang Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/drivers/char/mem.c b/drivers/char/mem.c index 1f3215ac085b..47c8452f485f 100644 --- a/drivers/char/mem.c +++ b/drivers/char/mem.c @@ -908,6 +908,9 @@ static int __init chr_dev_init(void) printk("unable to get major %d for memory devs\n", MEM_MAJOR); mem_class = class_create(THIS_MODULE, "mem"); + if (IS_ERR(mem_class)) + return PTR_ERR(mem_class); + mem_class->devnode = mem_devnode; for (minor = 1; minor < ARRAY_SIZE(devlist); minor++) { if (!devlist[minor].name)