From: Thadeu Lima de Souza Cascardo Date: Sun, 6 Dec 2009 22:29:25 +0000 (-0200) Subject: kfree is OK in case we haven't added the device. X-Git-Url: http://git.cascardo.info/?p=cascardo%2Fkernel%2Fsamples%2F02.char%2F.git;a=commitdiff_plain;h=66945cb744a5259446eb796a007121125c9e4701;hp=c4abffb96e4ac41ee136d518ed2e8cad2a4cc819 kfree is OK in case we haven't added the device. --- diff --git a/helloc.c b/helloc.c index 4d99fcb..1a2c238 100644 --- 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: