cpufreq: mediatek: add missing platform_driver_unregister() on error in mtk_cpufreq_driver_init
diff mbox series

Message ID 20201031011854.137261-1-miaoqinglang@huawei.com
State In Next
Commit a43128837003af389fb652680db66c1c050495f9
Headers show
Series
  • cpufreq: mediatek: add missing platform_driver_unregister() on error in mtk_cpufreq_driver_init
Related show

Commit Message

Qinglang Miao Oct. 31, 2020, 1:18 a.m. UTC
Add the missing platform_driver_unregister() before return from
mtk_cpufreq_driver_init in the error handling case when failed
to register mtk-cpufreq platform device

Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
---
 drivers/cpufreq/mediatek-cpufreq.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Viresh Kumar Nov. 2, 2020, 4:46 a.m. UTC | #1
On 31-10-20, 09:18, Qinglang Miao wrote:
> Add the missing platform_driver_unregister() before return from
> mtk_cpufreq_driver_init in the error handling case when failed
> to register mtk-cpufreq platform device
> 
> Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
> ---
>  drivers/cpufreq/mediatek-cpufreq.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/cpufreq/mediatek-cpufreq.c b/drivers/cpufreq/mediatek-cpufreq.c
> index 7d1212c9b..c03c76a0c 100644
> --- a/drivers/cpufreq/mediatek-cpufreq.c
> +++ b/drivers/cpufreq/mediatek-cpufreq.c
> @@ -572,6 +572,7 @@ static int __init mtk_cpufreq_driver_init(void)
>  	pdev = platform_device_register_simple("mtk-cpufreq", -1, NULL, 0);
>  	if (IS_ERR(pdev)) {
>  		pr_err("failed to register mtk-cpufreq platform device\n");
> +		platform_driver_unregister(&mtk_cpufreq_platdrv);
>  		return PTR_ERR(pdev);
>  	}

Applied. Thanks.

Patch
diff mbox series

diff --git a/drivers/cpufreq/mediatek-cpufreq.c b/drivers/cpufreq/mediatek-cpufreq.c
index 7d1212c9b..c03c76a0c 100644
--- a/drivers/cpufreq/mediatek-cpufreq.c
+++ b/drivers/cpufreq/mediatek-cpufreq.c
@@ -572,6 +572,7 @@  static int __init mtk_cpufreq_driver_init(void)
 	pdev = platform_device_register_simple("mtk-cpufreq", -1, NULL, 0);
 	if (IS_ERR(pdev)) {
 		pr_err("failed to register mtk-cpufreq platform device\n");
+		platform_driver_unregister(&mtk_cpufreq_platdrv);
 		return PTR_ERR(pdev);
 	}