Message ID | 20230816034800.4081842-1-yangyingliang@huawei.com (mailing list archive) |
---|---|
State | Awaiting Upstream, archived |
Headers | show |
Series | [-next] clk: imx: imx8: fix some error handles | expand |
> > device_link_add() returns NULL pointer not PTR_ERR() when it fails, so > replace the IS_ERR() check with NULL pointer check and set the error code to > -EINVAL. > > Set error code in the error path in imx8_acm_clk_probe(). > > Fixes: d3a0946d7ac9 ("clk: imx: imx8: add audio clock mux driver") > Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> Acked-by: Shengjiu Wang <shengjiu.wang@gmail.com> Best regards Wang shengjiu > --- > drivers/clk/imx/clk-imx8-acm.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/drivers/clk/imx/clk-imx8-acm.c b/drivers/clk/imx/clk-imx8-acm.c > index 1e82f72b75c6..550ceac45ff2 100644 > --- a/drivers/clk/imx/clk-imx8-acm.c > +++ b/drivers/clk/imx/clk-imx8-acm.c > @@ -287,9 +287,9 @@ static int clk_imx_acm_attach_pm_domains(struct > device *dev, > DL_FLAG_STATELESS | > DL_FLAG_PM_RUNTIME | > DL_FLAG_RPM_ACTIVE); > - if (IS_ERR(dev_pm->pd_dev_link[i])) { > + if (!dev_pm->pd_dev_link[i]) { > dev_pm_domain_detach(dev_pm->pd_dev[i], false); > - ret = PTR_ERR(dev_pm->pd_dev_link[i]); > + ret = -EINVAL; > goto detach_pm; > } > } > @@ -372,6 +372,7 @@ static int imx8_acm_clk_probe(struct > platform_device *pdev) > 0, NULL, NULL); > if (IS_ERR(hws[sels[i].clkid])) { > pm_runtime_disable(&pdev->dev); > + ret = PTR_ERR(hws[sels[i].clkid]); > goto err_clk_register; > } > } > -- > 2.25.1
diff --git a/drivers/clk/imx/clk-imx8-acm.c b/drivers/clk/imx/clk-imx8-acm.c index 1e82f72b75c6..550ceac45ff2 100644 --- a/drivers/clk/imx/clk-imx8-acm.c +++ b/drivers/clk/imx/clk-imx8-acm.c @@ -287,9 +287,9 @@ static int clk_imx_acm_attach_pm_domains(struct device *dev, DL_FLAG_STATELESS | DL_FLAG_PM_RUNTIME | DL_FLAG_RPM_ACTIVE); - if (IS_ERR(dev_pm->pd_dev_link[i])) { + if (!dev_pm->pd_dev_link[i]) { dev_pm_domain_detach(dev_pm->pd_dev[i], false); - ret = PTR_ERR(dev_pm->pd_dev_link[i]); + ret = -EINVAL; goto detach_pm; } } @@ -372,6 +372,7 @@ static int imx8_acm_clk_probe(struct platform_device *pdev) 0, NULL, NULL); if (IS_ERR(hws[sels[i].clkid])) { pm_runtime_disable(&pdev->dev); + ret = PTR_ERR(hws[sels[i].clkid]); goto err_clk_register; } }
device_link_add() returns NULL pointer not PTR_ERR() when it fails, so replace the IS_ERR() check with NULL pointer check and set the error code to -EINVAL. Set error code in the error path in imx8_acm_clk_probe(). Fixes: d3a0946d7ac9 ("clk: imx: imx8: add audio clock mux driver") Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> --- drivers/clk/imx/clk-imx8-acm.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)