summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoyeon <boyeon.son@samsung.com>2019-08-29 13:51:31 +0900
committerJeonghoon Park <jh1979.park@samsung.com>2019-08-29 18:42:34 +0900
commite5cac3d1c32bcb4bfda03dc2aa1fefc9a334f74d (patch)
treebb090201e30ff4ac513ec3d58a6e93d4186f69d5
parentc61f5ecf42298fc732ae22f4fd1de7ae35b35671 (diff)
downloadst-things-light-e5cac3d1c32bcb4bfda03dc2aa1fefc9a334f74d.tar.gz
st-things-light-e5cac3d1c32bcb4bfda03dc2aa1fefc9a334f74d.tar.bz2
st-things-light-e5cac3d1c32bcb4bfda03dc2aa1fefc9a334f74d.zip
Add specific statements for checking errorbasic-interrupted
patch 2: remove test code Change-Id: I402fc28d80d8038578bd9f8fec5e9cf8a7c8b089
-rwxr-xr-xsrc/resource/resource_infrared_motion.c7
-rwxr-xr-xsrc/resource/resource_led.c7
2 files changed, 8 insertions, 6 deletions
diff --git a/src/resource/resource_infrared_motion.c b/src/resource/resource_infrared_motion.c
index b432637..9263143 100755
--- a/src/resource/resource_infrared_motion.c
+++ b/src/resource/resource_infrared_motion.c
@@ -50,10 +50,11 @@ static int _resource_validate_infrared_motion(int pin_num)
static int resource_open_infrared_motion(int pin_num)
{
+ int ret = PERIPHERAL_ERROR_NONE;
peripheral_gpio_h temp = NULL;
- int ret = peripheral_gpio_open(pin_num, &temp);
- if (ret) {
+ ret = peripheral_gpio_open(pin_num, &temp);
+ if (ret != PERIPHERAL_ERROR_NONE) {
_E("peripheral_gpio_open failed.");
return -1;
}
@@ -67,7 +68,7 @@ static int resource_open_infrared_motion(int pin_num)
}
ret = peripheral_gpio_set_direction(temp, PERIPHERAL_GPIO_DIRECTION_IN);
- if (ret) {
+ if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_gpio_close(temp);
_E("peripheral_gpio_set_direction failed.");
return -1;
diff --git a/src/resource/resource_led.c b/src/resource/resource_led.c
index 4d5d15d..a6edd7c 100755
--- a/src/resource/resource_led.c
+++ b/src/resource/resource_led.c
@@ -43,17 +43,18 @@ int _resource_validate_led(int pin_num)
int resource_open_led(int pin_num)
{
+ int ret = PERIPHERAL_ERROR_NONE;
peripheral_gpio_h temp = NULL;
- int ret = peripheral_gpio_open(pin_num, &temp);
- if (ret) {
+ ret = peripheral_gpio_open(pin_num, &temp);
+ if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_gpio_close(temp);
_E("peripheral_gpio_open failed.");
return -1;
}
ret = peripheral_gpio_set_direction(temp, PERIPHERAL_GPIO_DIRECTION_OUT_INITIALLY_LOW);
- if (ret) {
+ if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_gpio_close(temp);
_E("peripheral_gpio_set_direction failed.");
return -1;