kfree is OK in case we haven't added the device.
[cascardo/kernel/samples/02.char/.git] / helloc.c
index 4d99fcb..1a2c238 100644 (file)
--- a/helloc.c
+++ b/helloc.c
@@ -51,7 +51,7 @@ static int __init helloc_init(void)
                goto out_add;
        return 0;
 out_add:
-       kobject_put(&cdev->kobj);
+       kfree(&cdev->kobj);
 out_alloc:
        unregister_chrdev_region(dev, 1);
 out_region: