diff options
author | Jin Yoon <jinny.yoon@samsung.com> | 2017-07-04 18:02:21 +0900 |
---|---|---|
committer | Eunyoung Lee <ey928.lee@samsung.com> | 2017-07-04 19:46:51 +0900 |
commit | 1cb28424e5d5473042a81a425f9eef1a49ad3278 (patch) | |
tree | 153169fd1cd02be59ee89b82774384c32d404ac5 | |
parent | 7be71f5a1871255577c0218e0d226f83012b31e5 (diff) | |
download | position-finder-server-1cb28424e5d5473042a81a425f9eef1a49ad3278.tar.gz position-finder-server-1cb28424e5d5473042a81a425f9eef1a49ad3278.tar.bz2 position-finder-server-1cb28424e5d5473042a81a425f9eef1a49ad3278.zip |
Free resources on error conditions
Change-Id: Ibe75f5f522ef8bb5da6df18aa3d9af162d57e13a
-rw-r--r-- | src/model/model_infrared_motion_sensor.c | 4 | ||||
-rw-r--r-- | src/model/model_infrared_obstacle_avoidance_sensor.c | 4 | ||||
-rw-r--r-- | src/model/model_touch_sensor.c | 4 |
3 files changed, 6 insertions, 6 deletions
diff --git a/src/model/model_infrared_motion_sensor.c b/src/model/model_infrared_motion_sensor.c index 52d9b83..2215572 100644 --- a/src/model/model_infrared_motion_sensor.c +++ b/src/model/model_infrared_motion_sensor.c @@ -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); diff --git a/src/model/model_infrared_obstacle_avoidance_sensor.c b/src/model/model_infrared_obstacle_avoidance_sensor.c index 9bed0eb..e63828a 100644 --- a/src/model/model_infrared_obstacle_avoidance_sensor.c +++ b/src/model/model_infrared_obstacle_avoidance_sensor.c @@ -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); diff --git a/src/model/model_touch_sensor.c b/src/model/model_touch_sensor.c index 749c583..f9a9580 100644 --- a/src/model/model_touch_sensor.c +++ b/src/model/model_touch_sensor.c @@ -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); |