* [PATCH 0/3] remoteproc: imx_rproc: Improve 'imx_rproc_probe()'
@ 2018-03-14 19:56 Christophe JAILLET
2018-03-14 19:56 ` [PATCH 1/3] remoteproc: imx_rproc: Fix an error handling path in 'imx_rproc_probe()' Christophe JAILLET
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Christophe JAILLET @ 2018-03-14 19:56 UTC (permalink / raw)
To: ohad, bjorn.andersson
Cc: linux-remoteproc, linux-kernel, kernel-janitors, Christophe JAILLET
Patch 1 fixes a bug.
Patches 2 and 3 are just clean-ups.
Christophe JAILLET (3):
remoteproc: imx_rproc: Fix an error handling path in
'imx_rproc_probe()'
remoteproc: imx_rproc: Re-use existing error handling path in
'imx_rproc_probe()'
remoteproc: imx_rproc: Slightly simplify code in 'imx_rproc_probe()'
drivers/remoteproc/imx_rproc.c | 23 +++++++++++------------
1 file changed, 11 insertions(+), 12 deletions(-)
--
2.14.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/3] remoteproc: imx_rproc: Fix an error handling path in 'imx_rproc_probe()'
2018-03-14 19:56 [PATCH 0/3] remoteproc: imx_rproc: Improve 'imx_rproc_probe()' Christophe JAILLET
@ 2018-03-14 19:56 ` Christophe JAILLET
2018-03-14 19:56 ` [PATCH 2/3] remoteproc: imx_rproc: Re-use existing " Christophe JAILLET
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Christophe JAILLET @ 2018-03-14 19:56 UTC (permalink / raw)
To: ohad, bjorn.andersson
Cc: linux-remoteproc, linux-kernel, kernel-janitors, Christophe JAILLET
If 'of_device_get_match_data()' fails, we must undo the previous
'rproc_alloc()' call.
Fixes: a0ff4aa6f010 ("remoteproc: imx_rproc: add a NXP/Freescale imx_rproc driver")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
drivers/remoteproc/imx_rproc.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c
index 633268e9d550..05bcbce2013a 100644
--- a/drivers/remoteproc/imx_rproc.c
+++ b/drivers/remoteproc/imx_rproc.c
@@ -339,8 +339,10 @@ static int imx_rproc_probe(struct platform_device *pdev)
}
dcfg = of_device_get_match_data(dev);
- if (!dcfg)
- return -EINVAL;
+ if (!dcfg) {
+ ret = -EINVAL;
+ goto err_put_rproc;
+ }
priv = rproc->priv;
priv->rproc = rproc;
--
2.14.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/3] remoteproc: imx_rproc: Re-use existing error handling path in 'imx_rproc_probe()'
2018-03-14 19:56 [PATCH 0/3] remoteproc: imx_rproc: Improve 'imx_rproc_probe()' Christophe JAILLET
2018-03-14 19:56 ` [PATCH 1/3] remoteproc: imx_rproc: Fix an error handling path in 'imx_rproc_probe()' Christophe JAILLET
@ 2018-03-14 19:56 ` Christophe JAILLET
2018-03-14 19:56 ` [PATCH 3/3] remoteproc: imx_rproc: Slightly simplify code " Christophe JAILLET
2018-03-18 22:44 ` [PATCH 0/3] remoteproc: imx_rproc: Improve 'imx_rproc_probe()' Bjorn Andersson
3 siblings, 0 replies; 5+ messages in thread
From: Christophe JAILLET @ 2018-03-14 19:56 UTC (permalink / raw)
To: ohad, bjorn.andersson
Cc: linux-remoteproc, linux-kernel, kernel-janitors, Christophe JAILLET
Avoid some code ducplication and be more future-proof.
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
drivers/remoteproc/imx_rproc.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c
index 05bcbce2013a..6d02ef62a626 100644
--- a/drivers/remoteproc/imx_rproc.c
+++ b/drivers/remoteproc/imx_rproc.c
@@ -361,8 +361,8 @@ static int imx_rproc_probe(struct platform_device *pdev)
priv->clk = devm_clk_get(dev, NULL);
if (IS_ERR(priv->clk)) {
dev_err(dev, "Failed to get clock\n");
- rproc_free(rproc);
- return PTR_ERR(priv->clk);
+ ret = PTR_ERR(priv->clk);
+ goto err_put_rproc;
}
/*
@@ -372,8 +372,7 @@ static int imx_rproc_probe(struct platform_device *pdev)
ret = clk_prepare_enable(priv->clk);
if (ret) {
dev_err(&rproc->dev, "Failed to enable clock\n");
- rproc_free(rproc);
- return ret;
+ goto err_put_rproc;
}
ret = rproc_add(rproc);
--
2.14.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 3/3] remoteproc: imx_rproc: Slightly simplify code in 'imx_rproc_probe()'
2018-03-14 19:56 [PATCH 0/3] remoteproc: imx_rproc: Improve 'imx_rproc_probe()' Christophe JAILLET
2018-03-14 19:56 ` [PATCH 1/3] remoteproc: imx_rproc: Fix an error handling path in 'imx_rproc_probe()' Christophe JAILLET
2018-03-14 19:56 ` [PATCH 2/3] remoteproc: imx_rproc: Re-use existing " Christophe JAILLET
@ 2018-03-14 19:56 ` Christophe JAILLET
2018-03-18 22:44 ` [PATCH 0/3] remoteproc: imx_rproc: Improve 'imx_rproc_probe()' Bjorn Andersson
3 siblings, 0 replies; 5+ messages in thread
From: Christophe JAILLET @ 2018-03-14 19:56 UTC (permalink / raw)
To: ohad, bjorn.andersson
Cc: linux-remoteproc, linux-kernel, kernel-janitors, Christophe JAILLET
We can return directly at the beginning of the function and save the 'err'
label.
We can also explicitly return 0 when the probe succeed.
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
drivers/remoteproc/imx_rproc.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c
index 6d02ef62a626..54c07fd3f204 100644
--- a/drivers/remoteproc/imx_rproc.c
+++ b/drivers/remoteproc/imx_rproc.c
@@ -333,10 +333,8 @@ static int imx_rproc_probe(struct platform_device *pdev)
/* set some other name then imx */
rproc = rproc_alloc(dev, "imx-rproc", &imx_rproc_ops,
NULL, sizeof(*priv));
- if (!rproc) {
- ret = -ENOMEM;
- goto err;
- }
+ if (!rproc)
+ return -ENOMEM;
dcfg = of_device_get_match_data(dev);
if (!dcfg) {
@@ -381,13 +379,13 @@ static int imx_rproc_probe(struct platform_device *pdev)
goto err_put_clk;
}
- return ret;
+ return 0;
err_put_clk:
clk_disable_unprepare(priv->clk);
err_put_rproc:
rproc_free(rproc);
-err:
+
return ret;
}
--
2.14.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 0/3] remoteproc: imx_rproc: Improve 'imx_rproc_probe()'
2018-03-14 19:56 [PATCH 0/3] remoteproc: imx_rproc: Improve 'imx_rproc_probe()' Christophe JAILLET
` (2 preceding siblings ...)
2018-03-14 19:56 ` [PATCH 3/3] remoteproc: imx_rproc: Slightly simplify code " Christophe JAILLET
@ 2018-03-18 22:44 ` Bjorn Andersson
3 siblings, 0 replies; 5+ messages in thread
From: Bjorn Andersson @ 2018-03-18 22:44 UTC (permalink / raw)
To: Christophe JAILLET; +Cc: ohad, linux-remoteproc, linux-kernel, kernel-janitors
On Wed 14 Mar 12:56 PDT 2018, Christophe JAILLET wrote:
> Patch 1 fixes a bug.
> Patches 2 and 3 are just clean-ups.
>
All three patches applied.
Thanks,
Bjorn
> Christophe JAILLET (3):
> remoteproc: imx_rproc: Fix an error handling path in
> 'imx_rproc_probe()'
> remoteproc: imx_rproc: Re-use existing error handling path in
> 'imx_rproc_probe()'
> remoteproc: imx_rproc: Slightly simplify code in 'imx_rproc_probe()'
>
> drivers/remoteproc/imx_rproc.c | 23 +++++++++++------------
> 1 file changed, 11 insertions(+), 12 deletions(-)
>
> --
> 2.14.1
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-03-18 22:44 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-14 19:56 [PATCH 0/3] remoteproc: imx_rproc: Improve 'imx_rproc_probe()' Christophe JAILLET
2018-03-14 19:56 ` [PATCH 1/3] remoteproc: imx_rproc: Fix an error handling path in 'imx_rproc_probe()' Christophe JAILLET
2018-03-14 19:56 ` [PATCH 2/3] remoteproc: imx_rproc: Re-use existing " Christophe JAILLET
2018-03-14 19:56 ` [PATCH 3/3] remoteproc: imx_rproc: Slightly simplify code " Christophe JAILLET
2018-03-18 22:44 ` [PATCH 0/3] remoteproc: imx_rproc: Improve 'imx_rproc_probe()' Bjorn Andersson
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).