modified maru usb, jack and power supply for removing sonar violations
authorsungmin ha <sungmin82.ha@samsung.com>
Thu, 13 Dec 2012 10:38:26 +0000 (19:38 +0900)
committersungmin ha <sungmin82.ha@samsung.com>
Thu, 13 Dec 2012 10:38:26 +0000 (19:38 +0900)
drivers/maru/maru_jack.c
drivers/maru/maru_power_supply.c
drivers/maru/maru_usb_mass_storage.c
drivers/maru/maru_usb_mode.c
package/pkginfo.manifest

index 11a77444f7059ad4c20708896e03ec5f0df871b2..6f4526e3e146d79185b07f30784f566024d9700f 100644 (file)
@@ -198,7 +198,8 @@ static int __init sysfs_test_init(void)
        if (!data) {\r
                printk("[%s] kzalloc error\n", __FUNCTION__);\r
                err = -ENOMEM;\r
-               goto alloc_err;\r
+               platform_device_unregister(&the_pdev);\r
+               return err;\r
        }\r
 \r
        dev_set_drvdata(&the_pdev.dev, (void*)data);\r
@@ -206,17 +207,10 @@ static int __init sysfs_test_init(void)
        err = sysfs_test_create_file(&the_pdev.dev);\r
        if (err) {\r
                printk("sysfs_create_file error\n");\r
-               goto sysfs_err;\r
+               kfree(data);\r
        }\r
 \r
        return 0;\r
-\r
-sysfs_err:\r
-       kfree(data);\r
-\r
-alloc_err:\r
-       platform_device_unregister(&the_pdev);\r
-       return err;\r
 }\r
 \r
 static void __exit sysfs_test_exit(void) \r
index b72dd331524c64fe6ab1297613ffe062ede08b8d..13e15c98ae79733a9df6f80df09ff3469dad1102 100644 (file)
@@ -99,16 +99,23 @@ struct device new_device_dev;
 \r
 static int __init sysfs_test_init(void) \r
 {\r
-       int err;\r
+       int err, i;\r
        printk("[%s] \n", __FUNCTION__);\r
 \r
        mtd_class = class_create(THIS_MODULE, "power_supply");\r
        mtd_device = device_create(mtd_class, NULL, (dev_t)NULL, NULL, "battery");\r
        \r
-       err = device_create_file(mtd_device, &ps_device_attributes[0]);\r
-       err = device_create_file(mtd_device, &ps_device_attributes[1]);\r
-       err = device_create_file(mtd_device, &ps_device_attributes[2]);\r
-\r
+       for (i = 0; i < 3; i++) {
+               err = device_create_file(mtd_device, &ps_device_attributes[i]);\r
+               if (err) {
+                       while (--i >= 0)
+                               device_remove_file(mtd_device, &ps_device_attributes[i]);
+               
+                       device_unregister(mtd_device);
+                       return err;
+               }
+       }\r
+       
        return 0;\r
 }\r
 \r
index d3aaee722c4247d1a94b789e7f0942646438e33e..45657848fb920d35b52e0aa3117bc3e7e84f6dd2 100644 (file)
@@ -190,7 +190,8 @@ static int __init sysfs_test_init(void)
        if (!data) {\r
                printk("[%s] kzalloc error\n", __FUNCTION__);\r
                err = -ENOMEM;\r
-               goto alloc_err;\r
+               platform_device_unregister(&the_pdev);\r
+               return err;\r
        }\r
 \r
        dev_set_drvdata(&the_pdev.dev, (void*)data);\r
@@ -200,23 +201,16 @@ static int __init sysfs_test_init(void)
        err = sysfs_lun0_create_file(&the_pdev_sub1.dev);\r
        if (err) {\r
                printk("sysfs_create_file error\n");\r
-               goto sysfs_err;\r
+               kfree(data);\r
        }\r
        \r
        err = sysfs_lun1_create_file(&the_pdev_sub2.dev);\r
        if (err) {\r
                printk("sysfs_create_file error\n");\r
-               goto sysfs_err;\r
+               kfree(data);\r
        }\r
-\r
+       \r
        return 0;\r
-\r
-sysfs_err:\r
-       kfree(data);\r
-\r
-alloc_err:\r
-       platform_device_unregister(&the_pdev);\r
-       return err;\r
 }\r
 \r
 static void __exit sysfs_test_exit(void) \r
index a4c4fc517e27f8c680f261646f860c4974f6c951..6abf84c5ccccc8bf946c81fcb172e9c94fa2bee1 100644 (file)
@@ -103,7 +103,8 @@ static int __init sysfs_test_init(void)
        if (!data) {\r
                printk("[%s] kzalloc error\n", __FUNCTION__);\r
                err = -ENOMEM;\r
-               goto alloc_err;\r
+               platform_device_unregister(&the_pdev);\r
+               return err;\r
        }\r
 \r
        dev_set_drvdata(&the_pdev.dev, (void*)data);\r
@@ -111,17 +112,10 @@ static int __init sysfs_test_init(void)
        err = sysfs_test_create_file(&the_pdev.dev);\r
        if (err) {\r
                printk("sysfs_create_file error\n");\r
-               goto sysfs_err;\r
+               kfree(data);\r
        }\r
 \r
        return 0;\r
-\r
-sysfs_err:\r
-       kfree(data);\r
-\r
-alloc_err:\r
-       platform_device_unregister(&the_pdev);\r
-       return err;\r
 }\r
 \r
 static void __exit sysfs_test_exit(void) \r
index be28137763a59a6e48aceabaa2e993b6305408b4..b4685e5d31869a2e07f0086cf162c0b3ab00c463 100644 (file)
@@ -1,4 +1,4 @@
-Version: 1.4.6
+Version: 1.4.7
 Maintainer: Yeong-Kyoon, Lee <yeongkyoon.lee@samsung.com>
 Source: emulator-kernel