From fc0a3f57acac9aa71b73df5023702950a118ad1e Mon Sep 17 00:00:00 2001 From: Konrad Kuchciak Date: Mon, 11 Feb 2019 08:45:18 +0100 Subject: [PATCH] pio: don't return from close function too early We need to reach the end of the peripheral_xxx_close function in order to free handle structure. Change-Id: I51cf86a106397d52773875efe60424f662373c0f Signed-off-by: Konrad Kuchciak --- src/peripheral_i2c.c | 4 +--- src/peripheral_pwm.c | 4 +--- src/peripheral_spi.c | 4 +--- src/peripheral_uart.c | 4 +--- 4 files changed, 4 insertions(+), 12 deletions(-) diff --git a/src/peripheral_i2c.c b/src/peripheral_i2c.c index c36d72f..84bca0d 100644 --- a/src/peripheral_i2c.c +++ b/src/peripheral_i2c.c @@ -91,10 +91,8 @@ int peripheral_i2c_close(peripheral_i2c_h i2c) RETVM_IF(i2c == NULL, PERIPHERAL_ERROR_INVALID_PARAMETER, "i2c handle is NULL"); ret = peripheral_gdbus_i2c_close(i2c); - if (ret != PERIPHERAL_ERROR_NONE) { + if (ret != PERIPHERAL_ERROR_NONE) _E("Failed to close i2c communcation, ret : %d", ret); - return ret; - } peripheral_interface_i2c_close(i2c); diff --git a/src/peripheral_pwm.c b/src/peripheral_pwm.c index ee0e829..d6a306a 100644 --- a/src/peripheral_pwm.c +++ b/src/peripheral_pwm.c @@ -83,10 +83,8 @@ int peripheral_pwm_close(peripheral_pwm_h pwm) RETVM_IF(pwm == NULL, PERIPHERAL_ERROR_INVALID_PARAMETER, "pwm handle is NULL"); ret = peripheral_gdbus_pwm_close(pwm); - if (ret != PERIPHERAL_ERROR_NONE) { + if (ret != PERIPHERAL_ERROR_NONE) _E("Failed to close PWM chip, continuing anyway, ret : %d", ret); - return ret; - } peripheral_interface_pwm_close(pwm); diff --git a/src/peripheral_spi.c b/src/peripheral_spi.c index 10faddb..8b168e5 100644 --- a/src/peripheral_spi.c +++ b/src/peripheral_spi.c @@ -82,10 +82,8 @@ int peripheral_spi_close(peripheral_spi_h spi) RETVM_IF(spi == NULL, PERIPHERAL_ERROR_INVALID_PARAMETER, "spi handle is NULL"); ret = peripheral_gdbus_spi_close(spi); - if (ret != PERIPHERAL_ERROR_NONE) { + if (ret != PERIPHERAL_ERROR_NONE) _E("Failed to close SPI device, continuing anyway, ret : %d", ret); - return ret; - } peripheral_interface_spi_close(spi); diff --git a/src/peripheral_uart.c b/src/peripheral_uart.c index 2b48f85..b572f83 100644 --- a/src/peripheral_uart.c +++ b/src/peripheral_uart.c @@ -87,10 +87,8 @@ int peripheral_uart_close(peripheral_uart_h uart) RETVM_IF(uart == NULL, PERIPHERAL_ERROR_INVALID_PARAMETER, "uart handle is NULL"); ret = peripheral_gdbus_uart_close(uart); - if (ret != PERIPHERAL_ERROR_NONE) { + if (ret != PERIPHERAL_ERROR_NONE) _E("Failed to close uart communication, continuing anyway, ret : %d", ret); - return ret; - } peripheral_interface_uart_close(uart); -- 2.34.1