summaryrefslogtreecommitdiffstats
path: root/drivers/char/bsr.c
diff options
context:
space:
mode:
authorDevendra Naga <develkernel412222@gmail.com>2012-07-15 15:22:02 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-07-17 19:27:38 +0200
commit8397c76a2c209997c7119bede2f26e51d8c786bc (patch)
tree25193b6ceac253bae795d86d55a331775674d7d7 /drivers/char/bsr.c
parentmei: mei_irq_thread_write_handler - line break fix (diff)
downloadlinux-8397c76a2c209997c7119bede2f26e51d8c786bc.tar.xz
linux-8397c76a2c209997c7119bede2f26e51d8c786bc.zip
powerpc/BSR: cleanup the error path of bsr_init
class_create if succeeded returns a pointer to the struct class, and if it fails, it returns a value enclosed by the pointer, which can be read by using PTR_ERR. Handle the error and return it. result is for error checking of the alloc_chrdev_region, instead ret can be used, and also if the alloc_chrdev_region fail, we are still returning -ENODEV, use ret and the error path will take care of returning of the ret. Signed-off-by: Devendra Naga <develkernel412222@gmail.com> Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/char/bsr.c')
-rw-r--r--drivers/char/bsr.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/char/bsr.c b/drivers/char/bsr.c
index 0c688232aab3..97467053a01b 100644
--- a/drivers/char/bsr.c
+++ b/drivers/char/bsr.c
@@ -297,7 +297,6 @@ static int __init bsr_init(void)
struct device_node *np;
dev_t bsr_dev;
int ret = -ENODEV;
- int result;
np = of_find_compatible_node(NULL, NULL, "ibm,bsr");
if (!np)
@@ -306,13 +305,14 @@ static int __init bsr_init(void)
bsr_class = class_create(THIS_MODULE, "bsr");
if (IS_ERR(bsr_class)) {
printk(KERN_ERR "class_create() failed for bsr_class\n");
+ ret = PTR_ERR(bsr_class);
goto out_err_1;
}
bsr_class->dev_attrs = bsr_dev_attrs;
- result = alloc_chrdev_region(&bsr_dev, 0, BSR_MAX_DEVS, "bsr");
+ ret = alloc_chrdev_region(&bsr_dev, 0, BSR_MAX_DEVS, "bsr");
bsr_major = MAJOR(bsr_dev);
- if (result < 0) {
+ if (ret < 0) {
printk(KERN_ERR "alloc_chrdev_region() failed for bsr\n");
goto out_err_2;
}