Re: [PATCH] clk: qcom: lpass-sc7180: Clean up on error in lpass_sc7180_init()

From: Doug Anderson
Date: Fri Nov 13 2020 - 12:29:07 EST


Hi,

On Fri, Nov 13, 2020 at 2:14 AM Dan Carpenter <dan.carpenter@xxxxxxxxxx> wrote:
>
> Clean up the first driver if the second driver can't be registered.
>
> Fixes: 4ee9fe3e292b ("clk: qcom: lpass-sc7180: Disentangle the two clock devices")
> Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
> ---
> drivers/clk/qcom/lpasscorecc-sc7180.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/clk/qcom/lpasscorecc-sc7180.c b/drivers/clk/qcom/lpasscorecc-sc7180.c
> index 1a3925badd7c..9081649f476f 100644
> --- a/drivers/clk/qcom/lpasscorecc-sc7180.c
> +++ b/drivers/clk/qcom/lpasscorecc-sc7180.c
> @@ -491,7 +491,13 @@ static int __init lpass_sc7180_init(void)
> if (ret)
> return ret;
>
> - return platform_driver_register(&lpass_hm_sc7180_driver);
> + ret = platform_driver_register(&lpass_hm_sc7180_driver);
> + if (ret) {
> + platform_driver_unregister(&lpass_core_cc_sc7180_driver);
> + return ret;
> + }
> +
> + return 0;

Reviewed-by: Douglas Anderson <dianders@xxxxxxxxxxxx>