diff mbox

[-next] ACPI / EC: Add missing destroy_workqueue() on error in acpi_ec_init()

Message ID 1469807604-32204-1-git-send-email-weiyj.lk@gmail.com (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Wei Yongjun July 29, 2016, 3:53 p.m. UTC
Add the missing destroy_workqueue() before return from
acpi_ec_init() in the error handling case.

Signed-off-by: Wei Yongjun <weiyj.lk@gmail.com>
---
 drivers/acpi/ec.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)




--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Lv Zheng Aug. 1, 2016, 12:39 a.m. UTC | #1
Hi, Yongjun

Thanks for the report.

> From: linux-acpi-owner@vger.kernel.org [mailto:linux-acpi-
> owner@vger.kernel.org] On Behalf Of Wei Yongjun
> Subject: [PATCH -next] ACPI / EC: Add missing destroy_workqueue() on
> error in acpi_ec_init()
> 
> Add the missing destroy_workqueue() before return from
> acpi_ec_init() in the error handling case.
> 
> Signed-off-by: Wei Yongjun <weiyj.lk@gmail.com>
> ---
>  drivers/acpi/ec.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
> index 9267554..853a55d 100644
> --- a/drivers/acpi/ec.c
> +++ b/drivers/acpi/ec.c
> @@ -1676,8 +1676,10 @@ int __init acpi_ec_init(void)
> 
>  	/* Now register the driver for the EC */
>  	result = acpi_bus_register_driver(&acpi_ec_driver);
> -	if (result < 0)
> +	if (result < 0) {
> +		destroy_workqueue(ec_query_wq);
[Lv Zheng] 
I think we should also set ec_query_wq = NULL.

>  		return -ENODEV;
> +	}
> 
[Lv Zheng] 
And probably could collect all cleanup code here before returning.

Thanks
Lv

>  	return result;
>  }
> 
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index 9267554..853a55d 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -1676,8 +1676,10 @@  int __init acpi_ec_init(void)
 
 	/* Now register the driver for the EC */
 	result = acpi_bus_register_driver(&acpi_ec_driver);
-	if (result < 0)
+	if (result < 0) {
+		destroy_workqueue(ec_query_wq);
 		return -ENODEV;
+	}
 
 	return result;
 }