Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1507710 > unrolled thread
| Started by | Christophe JAILLET <christophe.jaillet@wanadoo.fr> |
|---|---|
| First post | 2016-10-24 22:50 +0200 |
| Last post | 2016-10-25 22:40 +0200 |
| Articles | 3 — 3 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH 3/3] clk: keystone: Fix missing iounmap calls in an error handling path Christophe JAILLET <christophe.jaillet@wanadoo.fr> - 2016-10-24 22:50 +0200
Re: [PATCH 3/3] clk: keystone: Fix missing iounmap calls in an error handling path walter harms <wharms@bfs.de> - 2016-10-25 09:10 +0200
Re: [PATCH 3/3] clk: keystone: Fix missing iounmap calls in an error handling path Stephen Boyd <sboyd@codeaurora.org> - 2016-10-25 22:40 +0200
| From | Christophe JAILLET <christophe.jaillet@wanadoo.fr> |
|---|---|
| Date | 2016-10-24 22:50 +0200 |
| Subject | [PATCH 3/3] clk: keystone: Fix missing iounmap calls in an error handling path |
| Message-ID | <svUlX-4eX-3@gated-at.bofh.it> |
Factorize 'iounmap()' calls in the error handling path.
The main goal is to add these calls if 'clk_register_pll()' fails.
Add an error message if an 'of_iomap' call fails to be consistent.
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
Un-compiled & un-tested
---
drivers/clk/keystone/pll.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/drivers/clk/keystone/pll.c b/drivers/clk/keystone/pll.c
index 35c0e2b011d1..73a2558b29c0 100644
--- a/drivers/clk/keystone/pll.c
+++ b/drivers/clk/keystone/pll.c
@@ -191,7 +191,6 @@ static void __init _of_pll_clk_init(struct device_node *node, bool pllctrl)
pll_data->pll_ctl0 = of_iomap(node, i);
if (!pll_data->pll_ctl0) {
pr_err("%s: ioremap failed\n", __func__);
- iounmap(pll_data->pllod);
goto out;
}
@@ -206,8 +205,7 @@ static void __init _of_pll_clk_init(struct device_node *node, bool pllctrl)
i = of_property_match_string(node, "reg-names", "multiplier");
pll_data->pllm = of_iomap(node, i);
if (!pll_data->pllm) {
- iounmap(pll_data->pll_ctl0);
- iounmap(pll_data->pllod);
+ pr_err("%s: ioremap failed\n", __func__);
goto out;
}
}
@@ -220,6 +218,12 @@ static void __init _of_pll_clk_init(struct device_node *node, bool pllctrl)
out:
pr_err("%s: error initializing pll %s\n", __func__, node->name);
+ if (pll_data->pllm)
+ iounmap(pll_data->pllm);
+ if (pll_data->pll_ctl0)
+ iounmap(pll_data->pll_ctl0);
+ if (pll_data->pllod)
+ iounmap(pll_data->pllod);
kfree(pll_data);
}
--
2.9.3
[toc] | [next] | [standalone]
| From | walter harms <wharms@bfs.de> |
|---|---|
| Date | 2016-10-25 09:10 +0200 |
| Subject | Re: [PATCH 3/3] clk: keystone: Fix missing iounmap calls in an error handling path |
| Message-ID | <sw41X-2lL-11@gated-at.bofh.it> |
| In reply to | #1507710 |
Am 24.10.2016 22:43, schrieb Christophe JAILLET:
> Factorize 'iounmap()' calls in the error handling path.
> The main goal is to add these calls if 'clk_register_pll()' fails.
>
> Add an error message if an 'of_iomap' call fails to be consistent.
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> Un-compiled & un-tested
> ---
> drivers/clk/keystone/pll.c | 10 +++++++---
> 1 file changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/clk/keystone/pll.c b/drivers/clk/keystone/pll.c
> index 35c0e2b011d1..73a2558b29c0 100644
> --- a/drivers/clk/keystone/pll.c
> +++ b/drivers/clk/keystone/pll.c
> @@ -191,7 +191,6 @@ static void __init _of_pll_clk_init(struct device_node *node, bool pllctrl)
> pll_data->pll_ctl0 = of_iomap(node, i);
> if (!pll_data->pll_ctl0) {
> pr_err("%s: ioremap failed\n", __func__);
> - iounmap(pll_data->pllod);
> goto out;
> }
>
> @@ -206,8 +205,7 @@ static void __init _of_pll_clk_init(struct device_node *node, bool pllctrl)
> i = of_property_match_string(node, "reg-names", "multiplier");
> pll_data->pllm = of_iomap(node, i);
> if (!pll_data->pllm) {
> - iounmap(pll_data->pll_ctl0);
> - iounmap(pll_data->pllod);
> + pr_err("%s: ioremap failed\n", __func__);
> goto out;
> }
> }
> @@ -220,6 +218,12 @@ static void __init _of_pll_clk_init(struct device_node *node, bool pllctrl)
>
> out:
> pr_err("%s: error initializing pll %s\n", __func__, node->name);
> + if (pll_data->pllm)
> + iounmap(pll_data->pllm);
> + if (pll_data->pll_ctl0)
> + iounmap(pll_data->pll_ctl0);
> + if (pll_data->pllod)
> + iounmap(pll_data->pllod);
> kfree(pll_data);
> }
>
IMHO calles the iounmap() need no check for NULL.
re,
wh
[toc] | [prev] | [next] | [standalone]
| From | Stephen Boyd <sboyd@codeaurora.org> |
|---|---|
| Date | 2016-10-25 22:40 +0200 |
| Subject | Re: [PATCH 3/3] clk: keystone: Fix missing iounmap calls in an error handling path |
| Message-ID | <swgFP-25Y-7@gated-at.bofh.it> |
| In reply to | #1508018 |
On 10/25, walter harms wrote:
> Am 24.10.2016 22:43, schrieb Christophe JAILLET:
> > @@ -220,6 +218,12 @@ static void __init _of_pll_clk_init(struct device_node *node, bool pllctrl)
> >
> > out:
> > pr_err("%s: error initializing pll %s\n", __func__, node->name);
> > + if (pll_data->pllm)
> > + iounmap(pll_data->pllm);
> > + if (pll_data->pll_ctl0)
> > + iounmap(pll_data->pll_ctl0);
> > + if (pll_data->pllod)
> > + iounmap(pll_data->pllod);
> > kfree(pll_data);
> > }
> >
>
> IMHO calles the iounmap() need no check for NULL.
>
ARM doesn't seem to check for NULL there though. So that would be
a bug.
It would be nice to remove the checks though. Perhaps someone
could do that by unifying ionumap into asm-generic with the NULL
check and then have architecture specific functions for the rest
of it?
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web