* [PATCH -next] PM / devfreq: imx8m-ddrc: Fix inconsistent IS_ERR and PTR_ERR
@ 2019-12-30 8:47 YueHaibing
2019-12-30 17:35 ` Chanwoo Choi
0 siblings, 1 reply; 3+ messages in thread
From: YueHaibing @ 2019-12-30 8:47 UTC (permalink / raw)
To: myungjoo.ham, kyungmin.park, cw00.choi, shawnguo, s.hauer,
kernel, festevam, linux-imx
Cc: linux-pm, linux-arm-kernel, linux-kernel, YueHaibing
Fix inconsistent IS_ERR and PTR_ERR in imx8m_ddrc_probe().
Detected using Coccinelle.
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
drivers/devfreq/imx8m-ddrc.c | 24 ++++++++++++++++++------
1 file changed, 18 insertions(+), 6 deletions(-)
diff --git a/drivers/devfreq/imx8m-ddrc.c b/drivers/devfreq/imx8m-ddrc.c
index 53df792..bc82d36 100644
--- a/drivers/devfreq/imx8m-ddrc.c
+++ b/drivers/devfreq/imx8m-ddrc.c
@@ -395,15 +395,27 @@ static int imx8m_ddrc_probe(struct platform_device *pdev)
}
priv->dram_core = devm_clk_get(dev, "core");
+ if (IS_ERR(priv->dram_core)) {
+ ret = PTR_ERR(priv->dram_core);
+ dev_err(dev, "failed to fetch core clock: %d\n", ret);
+ return ret;
+ }
priv->dram_pll = devm_clk_get(dev, "pll");
+ if (IS_ERR(priv->dram_pll)) {
+ ret = PTR_ERR(priv->dram_pll);
+ dev_err(dev, "failed to fetch pll clock: %d\n", ret);
+ return ret;
+ }
priv->dram_alt = devm_clk_get(dev, "alt");
+ if (IS_ERR(priv->dram_alt)) {
+ ret = PTR_ERR(priv->dram_alt);
+ dev_err(dev, "failed to fetch alt clock: %d\n", ret);
+ return ret;
+ }
priv->dram_apb = devm_clk_get(dev, "apb");
- if (IS_ERR(priv->dram_core) ||
- IS_ERR(priv->dram_pll) ||
- IS_ERR(priv->dram_alt) ||
- IS_ERR(priv->dram_apb)) {
- ret = PTR_ERR(priv->devfreq);
- dev_err(dev, "failed to fetch clocks: %d\n", ret);
+ if (IS_ERR(priv->dram_apb)) {
+ ret = PTR_ERR(priv->dram_apb);
+ dev_err(dev, "failed to fetch apb clock: %d\n", ret);
return ret;
}
--
2.7.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH -next] PM / devfreq: imx8m-ddrc: Fix inconsistent IS_ERR and PTR_ERR
2019-12-30 8:47 [PATCH -next] PM / devfreq: imx8m-ddrc: Fix inconsistent IS_ERR and PTR_ERR YueHaibing
@ 2019-12-30 17:35 ` Chanwoo Choi
2019-12-30 18:08 ` Chanwoo Choi
0 siblings, 1 reply; 3+ messages in thread
From: Chanwoo Choi @ 2019-12-30 17:35 UTC (permalink / raw)
To: YueHaibing
Cc: MyungJoo Ham, Kyungmin Park, Chanwoo Choi, Shawn Guo, s.hauer,
kernel, festevam, dl-linux-imx, Linux PM list, linux-arm-kernel,
linux-kernel
On Mon, Dec 30, 2019 at 5:58 PM YueHaibing <yuehaibing@huawei.com> wrote:
>
> Fix inconsistent IS_ERR and PTR_ERR in imx8m_ddrc_probe().
> Detected using Coccinelle.
>
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> ---
> drivers/devfreq/imx8m-ddrc.c | 24 ++++++++++++++++++------
> 1 file changed, 18 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/devfreq/imx8m-ddrc.c b/drivers/devfreq/imx8m-ddrc.c
> index 53df792..bc82d36 100644
> --- a/drivers/devfreq/imx8m-ddrc.c
> +++ b/drivers/devfreq/imx8m-ddrc.c
> @@ -395,15 +395,27 @@ static int imx8m_ddrc_probe(struct platform_device *pdev)
> }
>
> priv->dram_core = devm_clk_get(dev, "core");
> + if (IS_ERR(priv->dram_core)) {
> + ret = PTR_ERR(priv->dram_core);
> + dev_err(dev, "failed to fetch core clock: %d\n", ret);
If there is no special reason, just use 'get' instead of ' fetch' word.
s/fetch/get
> + return ret;
> + }
> priv->dram_pll = devm_clk_get(dev, "pll");
> + if (IS_ERR(priv->dram_pll)) {
> + ret = PTR_ERR(priv->dram_pll);
> + dev_err(dev, "failed to fetch pll clock: %d\n", ret);
ditto.
> + return ret;
> + }
> priv->dram_alt = devm_clk_get(dev, "alt");
> + if (IS_ERR(priv->dram_alt)) {
> + ret = PTR_ERR(priv->dram_alt);
> + dev_err(dev, "failed to fetch alt clock: %d\n", ret);
ditto.
> + return ret;
> + }
> priv->dram_apb = devm_clk_get(dev, "apb");
> - if (IS_ERR(priv->dram_core) ||
> - IS_ERR(priv->dram_pll) ||
> - IS_ERR(priv->dram_alt) ||
> - IS_ERR(priv->dram_apb)) {
> - ret = PTR_ERR(priv->devfreq);
> - dev_err(dev, "failed to fetch clocks: %d\n", ret);
> + if (IS_ERR(priv->dram_apb)) {
> + ret = PTR_ERR(priv->dram_apb);
> + dev_err(dev, "failed to fetch apb clock: %d\n", ret);
ditto.
> return ret;
> }
>
> --
> 2.7.4
>
>
--
Best Regards,
Chanwoo Choi
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH -next] PM / devfreq: imx8m-ddrc: Fix inconsistent IS_ERR and PTR_ERR
2019-12-30 17:35 ` Chanwoo Choi
@ 2019-12-30 18:08 ` Chanwoo Choi
0 siblings, 0 replies; 3+ messages in thread
From: Chanwoo Choi @ 2019-12-30 18:08 UTC (permalink / raw)
To: YueHaibing
Cc: MyungJoo Ham, Kyungmin Park, Chanwoo Choi, Shawn Guo, s.hauer,
kernel, festevam, dl-linux-imx, Linux PM list, linux-arm-kernel,
linux-kernel
On Tue, Dec 31, 2019 at 2:35 AM Chanwoo Choi <chanwoo@kernel.org> wrote:
>
> On Mon, Dec 30, 2019 at 5:58 PM YueHaibing <yuehaibing@huawei.com> wrote:
> >
> > Fix inconsistent IS_ERR and PTR_ERR in imx8m_ddrc_probe().
> > Detected using Coccinelle.
> >
> > Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> > ---
> > drivers/devfreq/imx8m-ddrc.c | 24 ++++++++++++++++++------
> > 1 file changed, 18 insertions(+), 6 deletions(-)
> >
> > diff --git a/drivers/devfreq/imx8m-ddrc.c b/drivers/devfreq/imx8m-ddrc.c
> > index 53df792..bc82d36 100644
> > --- a/drivers/devfreq/imx8m-ddrc.c
> > +++ b/drivers/devfreq/imx8m-ddrc.c
> > @@ -395,15 +395,27 @@ static int imx8m_ddrc_probe(struct platform_device *pdev)
> > }
> >
> > priv->dram_core = devm_clk_get(dev, "core");
> > + if (IS_ERR(priv->dram_core)) {
> > + ret = PTR_ERR(priv->dram_core);
> > + dev_err(dev, "failed to fetch core clock: %d\n", ret);
>
> If there is no special reason, just use 'get' instead of ' fetch' word.
> s/fetch/get
Usually, use 'verb' included in function name to show the debug message.
But, Again thinking. the original comment used 'fetch' word. Please
ignore my comment
Applied it.
(snip)
Best Regards,
Chanwoo Choi
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-12-30 18:09 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-30 8:47 [PATCH -next] PM / devfreq: imx8m-ddrc: Fix inconsistent IS_ERR and PTR_ERR YueHaibing
2019-12-30 17:35 ` Chanwoo Choi
2019-12-30 18:08 ` Chanwoo Choi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).