Free resources on error conditions 70/137070/2
authorJin Yoon <jinny.yoon@samsung.com>
Tue, 4 Jul 2017 09:02:21 +0000 (18:02 +0900)
committerEunyoung Lee <ey928.lee@samsung.com>
Tue, 4 Jul 2017 10:46:51 +0000 (19:46 +0900)
Change-Id: Ibe75f5f522ef8bb5da6df18aa3d9af162d57e13a

src/model/model_infrared_motion_sensor.c
src/model/model_infrared_obstacle_avoidance_sensor.c
src/model/model_touch_sensor.c

index 52d9b836e140a611db93deac68fd8a9a0c724009..221557248f193b90b76c253e26d81050ceda8bb2 100644 (file)
@@ -56,8 +56,8 @@ int model_init_infrared_motion_sensor(int gpio_num, void **peripheral_info)
        *peripheral_info = info;
 
        ret = peripheral_gpio_open(gpio_num, &info->gpio);
-       retv_if(ret != 0, -1);
-       retv_if(!info->gpio, -1);
+       goto_if(ret != 0, error);
+       goto_if(!info->gpio, error);
 
        ret = peripheral_gpio_set_direction(info->gpio, PERIPHERAL_GPIO_DIRECTION_IN);
        goto_if(ret != 0, error);
index 9bed0eb02d6ca20dd55bb718d75be25efb551a83..e63828a92fdc3ba35cce0dc4cc9cd6af157b6054 100644 (file)
@@ -55,8 +55,8 @@ int model_init_infrared_obstacle_avoidance_sensor(int gpio_num, void **periphera
        *peripheral_info = info;
 
        ret = peripheral_gpio_open(gpio_num, &info->gpio);
-       retv_if(ret != 0, -1);
-       retv_if(!info->gpio, -1);
+       goto_if(ret != 0, error);
+       goto_if(!info->gpio, error);
 
        ret = peripheral_gpio_set_direction(info->gpio, PERIPHERAL_GPIO_DIRECTION_IN);
        goto_if(ret != 0, error);
index 749c58352503aa053fafc6768bf1a9a59b19b0d5..f9a958029dfb606feb85cb072f74a4b0f8ad7479 100644 (file)
@@ -54,8 +54,8 @@ int model_init_touch_sensor(int gpio_num, void **peripheral_info)
        *peripheral_info = info;
 
        ret = peripheral_gpio_open(gpio_num, &info->gpio);
-       retv_if(ret != 0, -1);
-       retv_if(!info->gpio, -1);
+       goto_if(ret != 0, error);
+       goto_if(!info->gpio, error);
 
        ret = peripheral_gpio_set_direction(info->gpio, PERIPHERAL_GPIO_DIRECTION_IN);
        goto_if(ret != 0, error);