Message ID | 20201113101419.GC168908@mwanda (mailing list archive) |
---|---|
State | Accepted, archived |
Headers | show |
Series | clk: qcom: lpass-sc7180: Clean up on error in lpass_sc7180_init() | expand |
Hi, On Fri, Nov 13, 2020 at 2:14 AM Dan Carpenter <dan.carpenter@oracle.com> 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@oracle.com> > --- > 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@chromium.org>
Quoting Dan Carpenter (2020-11-13 02:14:19) > 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@oracle.com> > --- Applied to clk-next
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; } subsys_initcall(lpass_sc7180_init);
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@oracle.com> --- drivers/clk/qcom/lpasscorecc-sc7180.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)