diff mbox series

acpi: devices: deiniit acpica when tests are skipped

Message ID 20171006001520.8461-1-alex.hung@canonical.com
State Accepted
Headers show
Series acpi: devices: deiniit acpica when tests are skipped | expand

Commit Message

Alex Hung Oct. 6, 2017, 12:15 a.m. UTC
deinit function in fwts_framework_ops is not called when init function
returns FWTS_SKIP. This patch fixes fwts_acpica_deinit() is not called.

Signed-off-by: Alex Hung <alex.hung@canonical.com>
---
 src/acpi/devices/ac_adapter/ac.c         | 1 +
 src/acpi/devices/battery/battery.c       | 1 +
 src/acpi/devices/battery/smart_battery.c | 1 +
 src/acpi/devices/ec/ec.c                 | 1 +
 4 files changed, 4 insertions(+)

Comments

Colin Ian King Oct. 6, 2017, 8:01 a.m. UTC | #1
On 06/10/17 01:15, Alex Hung wrote:
> deinit function in fwts_framework_ops is not called when init function
> returns FWTS_SKIP. This patch fixes fwts_acpica_deinit() is not called.
> 
> Signed-off-by: Alex Hung <alex.hung@canonical.com>
> ---
>  src/acpi/devices/ac_adapter/ac.c         | 1 +
>  src/acpi/devices/battery/battery.c       | 1 +
>  src/acpi/devices/battery/smart_battery.c | 1 +
>  src/acpi/devices/ec/ec.c                 | 1 +
>  4 files changed, 4 insertions(+)
> 
> diff --git a/src/acpi/devices/ac_adapter/ac.c b/src/acpi/devices/ac_adapter/ac.c
> index e573c4ba..d0323f24 100644
> --- a/src/acpi/devices/ac_adapter/ac.c
> +++ b/src/acpi/devices/ac_adapter/ac.c
> @@ -57,6 +57,7 @@ static int acpi_ac_init(fwts_framework *fw)
>  
>  	if (!device) {
>  		fwts_log_error(fw, "ACPI AC device does not exist, skipping test");
> +		fwts_acpica_deinit();
>  		return FWTS_SKIP;
>  	} else {
>  		ACPI_BUFFER buffer;
> diff --git a/src/acpi/devices/battery/battery.c b/src/acpi/devices/battery/battery.c
> index ec1322ad..f6922328 100644
> --- a/src/acpi/devices/battery/battery.c
> +++ b/src/acpi/devices/battery/battery.c
> @@ -57,6 +57,7 @@ static int acpi_battery_init(fwts_framework *fw)
>  
>  	if (!device) {
>  		fwts_log_error(fw, "ACPI Battery device does not exist, skipping test");
> +		fwts_acpica_deinit();
>  		return FWTS_SKIP;
>  	} else {
>  		ACPI_BUFFER buffer;
> diff --git a/src/acpi/devices/battery/smart_battery.c b/src/acpi/devices/battery/smart_battery.c
> index 81ecd529..f16f0f44 100644
> --- a/src/acpi/devices/battery/smart_battery.c
> +++ b/src/acpi/devices/battery/smart_battery.c
> @@ -57,6 +57,7 @@ static int smart_battery_init(fwts_framework *fw)
>  
>  	if (!device) {
>  		fwts_log_error(fw, "Smart Battery device does not exist, skipping test");
> +		fwts_acpica_deinit();
>  		return FWTS_SKIP;
>  	} else {
>  		ACPI_BUFFER buffer;
> diff --git a/src/acpi/devices/ec/ec.c b/src/acpi/devices/ec/ec.c
> index a7ff5ded..1ddcbfe5 100644
> --- a/src/acpi/devices/ec/ec.c
> +++ b/src/acpi/devices/ec/ec.c
> @@ -57,6 +57,7 @@ static int acpi_ec_init(fwts_framework *fw)
>  
>  	if (!device) {
>  		fwts_log_error(fw, "ACPI EC device does not exist, skipping test");
> +		fwts_acpica_deinit();
>  		return FWTS_SKIP;
>  	} else {
>  		ACPI_BUFFER buffer;
> 
Acked-by: Colin Ian King <colin.king@canonical.com>
Ivan Hu Oct. 11, 2017, 9:58 a.m. UTC | #2
On 10/06/2017 08:15 AM, Alex Hung wrote:
> deinit function in fwts_framework_ops is not called when init function
> returns FWTS_SKIP. This patch fixes fwts_acpica_deinit() is not called.
> 
> Signed-off-by: Alex Hung <alex.hung@canonical.com>
> ---
>   src/acpi/devices/ac_adapter/ac.c         | 1 +
>   src/acpi/devices/battery/battery.c       | 1 +
>   src/acpi/devices/battery/smart_battery.c | 1 +
>   src/acpi/devices/ec/ec.c                 | 1 +
>   4 files changed, 4 insertions(+)
> 
> diff --git a/src/acpi/devices/ac_adapter/ac.c b/src/acpi/devices/ac_adapter/ac.c
> index e573c4ba..d0323f24 100644
> --- a/src/acpi/devices/ac_adapter/ac.c
> +++ b/src/acpi/devices/ac_adapter/ac.c
> @@ -57,6 +57,7 @@ static int acpi_ac_init(fwts_framework *fw)
>   
>   	if (!device) {
>   		fwts_log_error(fw, "ACPI AC device does not exist, skipping test");
> +		fwts_acpica_deinit();
>   		return FWTS_SKIP;
>   	} else {
>   		ACPI_BUFFER buffer;
> diff --git a/src/acpi/devices/battery/battery.c b/src/acpi/devices/battery/battery.c
> index ec1322ad..f6922328 100644
> --- a/src/acpi/devices/battery/battery.c
> +++ b/src/acpi/devices/battery/battery.c
> @@ -57,6 +57,7 @@ static int acpi_battery_init(fwts_framework *fw)
>   
>   	if (!device) {
>   		fwts_log_error(fw, "ACPI Battery device does not exist, skipping test");
> +		fwts_acpica_deinit();
>   		return FWTS_SKIP;
>   	} else {
>   		ACPI_BUFFER buffer;
> diff --git a/src/acpi/devices/battery/smart_battery.c b/src/acpi/devices/battery/smart_battery.c
> index 81ecd529..f16f0f44 100644
> --- a/src/acpi/devices/battery/smart_battery.c
> +++ b/src/acpi/devices/battery/smart_battery.c
> @@ -57,6 +57,7 @@ static int smart_battery_init(fwts_framework *fw)
>   
>   	if (!device) {
>   		fwts_log_error(fw, "Smart Battery device does not exist, skipping test");
> +		fwts_acpica_deinit();
>   		return FWTS_SKIP;
>   	} else {
>   		ACPI_BUFFER buffer;
> diff --git a/src/acpi/devices/ec/ec.c b/src/acpi/devices/ec/ec.c
> index a7ff5ded..1ddcbfe5 100644
> --- a/src/acpi/devices/ec/ec.c
> +++ b/src/acpi/devices/ec/ec.c
> @@ -57,6 +57,7 @@ static int acpi_ec_init(fwts_framework *fw)
>   
>   	if (!device) {
>   		fwts_log_error(fw, "ACPI EC device does not exist, skipping test");
> +		fwts_acpica_deinit();
>   		return FWTS_SKIP;
>   	} else {
>   		ACPI_BUFFER buffer;
> 

Acked-by: Ivan Hu <ivan.hu@canonical.com>
diff mbox series

Patch

diff --git a/src/acpi/devices/ac_adapter/ac.c b/src/acpi/devices/ac_adapter/ac.c
index e573c4ba..d0323f24 100644
--- a/src/acpi/devices/ac_adapter/ac.c
+++ b/src/acpi/devices/ac_adapter/ac.c
@@ -57,6 +57,7 @@  static int acpi_ac_init(fwts_framework *fw)
 
 	if (!device) {
 		fwts_log_error(fw, "ACPI AC device does not exist, skipping test");
+		fwts_acpica_deinit();
 		return FWTS_SKIP;
 	} else {
 		ACPI_BUFFER buffer;
diff --git a/src/acpi/devices/battery/battery.c b/src/acpi/devices/battery/battery.c
index ec1322ad..f6922328 100644
--- a/src/acpi/devices/battery/battery.c
+++ b/src/acpi/devices/battery/battery.c
@@ -57,6 +57,7 @@  static int acpi_battery_init(fwts_framework *fw)
 
 	if (!device) {
 		fwts_log_error(fw, "ACPI Battery device does not exist, skipping test");
+		fwts_acpica_deinit();
 		return FWTS_SKIP;
 	} else {
 		ACPI_BUFFER buffer;
diff --git a/src/acpi/devices/battery/smart_battery.c b/src/acpi/devices/battery/smart_battery.c
index 81ecd529..f16f0f44 100644
--- a/src/acpi/devices/battery/smart_battery.c
+++ b/src/acpi/devices/battery/smart_battery.c
@@ -57,6 +57,7 @@  static int smart_battery_init(fwts_framework *fw)
 
 	if (!device) {
 		fwts_log_error(fw, "Smart Battery device does not exist, skipping test");
+		fwts_acpica_deinit();
 		return FWTS_SKIP;
 	} else {
 		ACPI_BUFFER buffer;
diff --git a/src/acpi/devices/ec/ec.c b/src/acpi/devices/ec/ec.c
index a7ff5ded..1ddcbfe5 100644
--- a/src/acpi/devices/ec/ec.c
+++ b/src/acpi/devices/ec/ec.c
@@ -57,6 +57,7 @@  static int acpi_ec_init(fwts_framework *fw)
 
 	if (!device) {
 		fwts_log_error(fw, "ACPI EC device does not exist, skipping test");
+		fwts_acpica_deinit();
 		return FWTS_SKIP;
 	} else {
 		ACPI_BUFFER buffer;