* [PATCH 0/3] clk: keystone: Fix some error handling paths
@ 2016-10-24 20:43 ` Christophe JAILLET
0 siblings, 0 replies; 18+ messages in thread
From: Christophe JAILLET @ 2016-10-24 20:43 UTC (permalink / raw)
To: lars, dan.carpenter, ssantosh, mturquette, sboyd
Cc: linux-clk, linux-kernel, kernel-janitors, Christophe JAILLET
The first of these 3 patches is a v2 of a patch posted earlier.
The main change in this v2 is the propagation of the error returned by
'clk_register_pll()'.
The 2nd one is completely un-related and fixes some typo in error messages
spoted while looking at the file.
Finaly, the 3rd one refactors the '_of_pll_clk_init' function in order to
factorize some cleanups in case of error and to add some missing 'iounmap()'
calls if 'clk_register_pll()' fails.
These patches are un-compiled. I get some errors for some reasons in my build
environment. I've not checked further the root cause of these build errors
but I guess that my plateform is not what is expected to build this code.
Christophe JAILLET (3):
clk: keystone: Fix an error checking
clk: keystone: Fix some error messages
clk: keystone: Fix missing iounmap calls in an error handling path
drivers/clk/keystone/pll.c | 20 ++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)
--
2.9.3
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 0/3] clk: keystone: Fix some error handling paths
@ 2016-10-24 20:43 ` Christophe JAILLET
0 siblings, 0 replies; 18+ messages in thread
From: Christophe JAILLET @ 2016-10-24 20:43 UTC (permalink / raw)
To: lars, dan.carpenter, ssantosh, mturquette, sboyd
Cc: linux-clk, linux-kernel, kernel-janitors, Christophe JAILLET
The first of these 3 patches is a v2 of a patch posted earlier.
The main change in this v2 is the propagation of the error returned by
'clk_register_pll()'.
The 2nd one is completely un-related and fixes some typo in error messages
spoted while looking at the file.
Finaly, the 3rd one refactors the '_of_pll_clk_init' function in order to
factorize some cleanups in case of error and to add some missing 'iounmap()'
calls if 'clk_register_pll()' fails.
These patches are un-compiled. I get some errors for some reasons in my build
environment. I've not checked further the root cause of these build errors
but I guess that my plateform is not what is expected to build this code.
Christophe JAILLET (3):
clk: keystone: Fix an error checking
clk: keystone: Fix some error messages
clk: keystone: Fix missing iounmap calls in an error handling path
drivers/clk/keystone/pll.c | 20 ++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)
--
2.9.3
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 1/3] clk: keystone: Fix an error checking
2016-10-24 20:43 ` Christophe JAILLET
@ 2016-10-24 20:43 ` Christophe JAILLET
-1 siblings, 0 replies; 18+ messages in thread
From: Christophe JAILLET @ 2016-10-24 20:43 UTC (permalink / raw)
To: lars, dan.carpenter, ssantosh, mturquette, sboyd
Cc: linux-clk, linux-kernel, kernel-janitors, Christophe JAILLET
clk_register_pll() can return ERR_PTR(-ENOMEM) so checking the return value
against NULL only is not correct.
In order to fix it, update clk_register_pll() to always return an error
pointer in case of error and check the return value with IS_ERR.
While at it, also fix a tab vs space in the surrounding code.
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
Un-compiled and un-tested.
---
drivers/clk/keystone/pll.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/clk/keystone/pll.c b/drivers/clk/keystone/pll.c
index a26ba2184454..70d6fb2d23bc 100644
--- a/drivers/clk/keystone/pll.c
+++ b/drivers/clk/keystone/pll.c
@@ -140,7 +140,7 @@ static struct clk *clk_register_pll(struct device *dev,
init.parent_names = (parent_name ? &parent_name : NULL);
init.num_parents = (parent_name ? 1 : 0);
- pll->pll_data = pll_data;
+ pll->pll_data = pll_data;
pll->hw.init = &init;
clk = clk_register(NULL, &pll->hw);
@@ -150,7 +150,7 @@ static struct clk *clk_register_pll(struct device *dev,
return clk;
out:
kfree(pll);
- return NULL;
+ return clk;
}
/**
@@ -213,7 +213,7 @@ static void __init _of_pll_clk_init(struct device_node *node, bool pllctrl)
}
clk = clk_register_pll(NULL, node->name, parent_name, pll_data);
- if (clk) {
+ if (!IS_ERR(clk)) {
of_clk_add_provider(node, of_clk_src_simple_get, clk);
return;
}
--
2.9.3
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 1/3] clk: keystone: Fix an error checking
@ 2016-10-24 20:43 ` Christophe JAILLET
0 siblings, 0 replies; 18+ messages in thread
From: Christophe JAILLET @ 2016-10-24 20:43 UTC (permalink / raw)
To: lars, dan.carpenter, ssantosh, mturquette, sboyd
Cc: linux-clk, linux-kernel, kernel-janitors, Christophe JAILLET
clk_register_pll() can return ERR_PTR(-ENOMEM) so checking the return value
against NULL only is not correct.
In order to fix it, update clk_register_pll() to always return an error
pointer in case of error and check the return value with IS_ERR.
While at it, also fix a tab vs space in the surrounding code.
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
Un-compiled and un-tested.
---
drivers/clk/keystone/pll.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/clk/keystone/pll.c b/drivers/clk/keystone/pll.c
index a26ba2184454..70d6fb2d23bc 100644
--- a/drivers/clk/keystone/pll.c
+++ b/drivers/clk/keystone/pll.c
@@ -140,7 +140,7 @@ static struct clk *clk_register_pll(struct device *dev,
init.parent_names = (parent_name ? &parent_name : NULL);
init.num_parents = (parent_name ? 1 : 0);
- pll->pll_data = pll_data;
+ pll->pll_data = pll_data;
pll->hw.init = &init;
clk = clk_register(NULL, &pll->hw);
@@ -150,7 +150,7 @@ static struct clk *clk_register_pll(struct device *dev,
return clk;
out:
kfree(pll);
- return NULL;
+ return clk;
}
/**
@@ -213,7 +213,7 @@ static void __init _of_pll_clk_init(struct device_node *node, bool pllctrl)
}
clk = clk_register_pll(NULL, node->name, parent_name, pll_data);
- if (clk) {
+ if (!IS_ERR(clk)) {
of_clk_add_provider(node, of_clk_src_simple_get, clk);
return;
}
--
2.9.3
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 2/3] clk: keystone: Fix some error messages
2016-10-24 20:43 ` Christophe JAILLET
@ 2016-10-24 20:43 ` Christophe JAILLET
-1 siblings, 0 replies; 18+ messages in thread
From: Christophe JAILLET @ 2016-10-24 20:43 UTC (permalink / raw)
To: lars, dan.carpenter, ssantosh, mturquette, sboyd
Cc: linux-clk, linux-kernel, kernel-janitors, Christophe JAILLET
Report 'bit-shift' in the error message as it is the property we are
looking for.
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
drivers/clk/keystone/pll.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/clk/keystone/pll.c b/drivers/clk/keystone/pll.c
index 70d6fb2d23bc..35c0e2b011d1 100644
--- a/drivers/clk/keystone/pll.c
+++ b/drivers/clk/keystone/pll.c
@@ -271,7 +271,7 @@ static void __init of_pll_div_clk_init(struct device_node *node)
}
if (of_property_read_u32(node, "bit-shift", &shift)) {
- pr_err("%s: missing 'shift' property\n", __func__);
+ pr_err("%s: missing 'bit-shift' property\n", __func__);
return;
}
@@ -315,7 +315,7 @@ static void __init of_pll_mux_clk_init(struct device_node *node)
}
if (of_property_read_u32(node, "bit-shift", &shift)) {
- pr_err("%s: missing 'shift' property\n", __func__);
+ pr_err("%s: missing 'bit-shift' property\n", __func__);
return;
}
--
2.9.3
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 2/3] clk: keystone: Fix some error messages
@ 2016-10-24 20:43 ` Christophe JAILLET
0 siblings, 0 replies; 18+ messages in thread
From: Christophe JAILLET @ 2016-10-24 20:43 UTC (permalink / raw)
To: lars, dan.carpenter, ssantosh, mturquette, sboyd
Cc: linux-clk, linux-kernel, kernel-janitors, Christophe JAILLET
Report 'bit-shift' in the error message as it is the property we are
looking for.
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
drivers/clk/keystone/pll.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/clk/keystone/pll.c b/drivers/clk/keystone/pll.c
index 70d6fb2d23bc..35c0e2b011d1 100644
--- a/drivers/clk/keystone/pll.c
+++ b/drivers/clk/keystone/pll.c
@@ -271,7 +271,7 @@ static void __init of_pll_div_clk_init(struct device_node *node)
}
if (of_property_read_u32(node, "bit-shift", &shift)) {
- pr_err("%s: missing 'shift' property\n", __func__);
+ pr_err("%s: missing 'bit-shift' property\n", __func__);
return;
}
@@ -315,7 +315,7 @@ static void __init of_pll_mux_clk_init(struct device_node *node)
}
if (of_property_read_u32(node, "bit-shift", &shift)) {
- pr_err("%s: missing 'shift' property\n", __func__);
+ pr_err("%s: missing 'bit-shift' property\n", __func__);
return;
}
--
2.9.3
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 3/3] clk: keystone: Fix missing iounmap calls in an error handling path
2016-10-24 20:43 ` Christophe JAILLET
@ 2016-10-24 20:43 ` Christophe JAILLET
-1 siblings, 0 replies; 18+ messages in thread
From: Christophe JAILLET @ 2016-10-24 20:43 UTC (permalink / raw)
To: lars, dan.carpenter, ssantosh, mturquette, sboyd
Cc: linux-clk, linux-kernel, kernel-janitors, 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);
}
--
2.9.3
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 3/3] clk: keystone: Fix missing iounmap calls in an error handling path
@ 2016-10-24 20:43 ` Christophe JAILLET
0 siblings, 0 replies; 18+ messages in thread
From: Christophe JAILLET @ 2016-10-24 20:43 UTC (permalink / raw)
To: lars, dan.carpenter, ssantosh, mturquette, sboyd
Cc: linux-clk, linux-kernel, kernel-janitors, 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);
}
--
2.9.3
^ permalink raw reply related [flat|nested] 18+ messages in thread
* Re: [PATCH 3/3] clk: keystone: Fix missing iounmap calls in an error handling path
2016-10-24 20:43 ` Christophe JAILLET
@ 2016-10-25 7:08 ` walter harms
-1 siblings, 0 replies; 18+ messages in thread
From: walter harms @ 2016-10-25 7:08 UTC (permalink / raw)
To: Christophe JAILLET
Cc: lars, dan.carpenter, ssantosh, mturquette, sboyd, linux-clk,
linux-kernel, kernel-janitors
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
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 3/3] clk: keystone: Fix missing iounmap calls in an error handling path
@ 2016-10-25 7:08 ` walter harms
0 siblings, 0 replies; 18+ messages in thread
From: walter harms @ 2016-10-25 7:08 UTC (permalink / raw)
To: Christophe JAILLET
Cc: lars, dan.carpenter, ssantosh, mturquette, sboyd, linux-clk,
linux-kernel, kernel-janitors
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
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 3/3] clk: keystone: Fix missing iounmap calls in an error handling path
2016-10-25 7:08 ` walter harms
@ 2016-10-25 20:35 ` Stephen Boyd
-1 siblings, 0 replies; 18+ messages in thread
From: Stephen Boyd @ 2016-10-25 20:35 UTC (permalink / raw)
To: walter harms
Cc: Christophe JAILLET, lars, dan.carpenter, ssantosh, mturquette,
linux-clk, linux-kernel, kernel-janitors
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
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 3/3] clk: keystone: Fix missing iounmap calls in an error handling path
@ 2016-10-25 20:35 ` Stephen Boyd
0 siblings, 0 replies; 18+ messages in thread
From: Stephen Boyd @ 2016-10-25 20:35 UTC (permalink / raw)
To: walter harms
Cc: Christophe JAILLET, lars, dan.carpenter, ssantosh, mturquette,
linux-clk, linux-kernel, kernel-janitors
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
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 3/3] clk: keystone: Fix missing iounmap calls in an error handling path
2016-10-24 20:43 ` Christophe JAILLET
(?)
(?)
@ 2016-10-26 12:14 ` walter harms
-1 siblings, 0 replies; 18+ messages in thread
From: walter harms @ 2016-10-26 12:14 UTC (permalink / raw)
To: kernel-janitors
Am 25.10.2016 22:35, schrieb Stephen Boyd:
> 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?
>
Is there a specific reason not to check ?
It seems not wise to have different behavior across architectures.
re,
wh
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 3/3] clk: keystone: Fix missing iounmap calls in an error handling path
2016-10-24 20:43 ` Christophe JAILLET
` (2 preceding siblings ...)
(?)
@ 2016-10-28 0:19 ` Stephen Boyd
-1 siblings, 0 replies; 18+ messages in thread
From: Stephen Boyd @ 2016-10-28 0:19 UTC (permalink / raw)
To: kernel-janitors
On 10/26, walter harms wrote:
>
>
> Am 25.10.2016 22:35, schrieb Stephen Boyd:
> > 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?
> >
>
> Is there a specific reason not to check ?
> It seems not wise to have different behavior across architectures.
>
I have no idea. Patches welcome.
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 1/3] clk: keystone: Fix an error checking
2016-10-24 20:43 ` Christophe JAILLET
@ 2016-11-02 0:22 ` Stephen Boyd
-1 siblings, 0 replies; 18+ messages in thread
From: Stephen Boyd @ 2016-11-02 0:22 UTC (permalink / raw)
To: Christophe JAILLET
Cc: lars, dan.carpenter, ssantosh, mturquette, linux-clk,
linux-kernel, kernel-janitors
On 10/24, Christophe JAILLET wrote:
> clk_register_pll() can return ERR_PTR(-ENOMEM) so checking the return value
> against NULL only is not correct.
The code just doesn't propagate the error up to the caller.
Instead the caller treats NULL as an error and non-NULL as valid.
If the callee detects an error it hides it and returns NULL.
> In order to fix it, update clk_register_pll() to always return an error
> pointer in case of error and check the return value with IS_ERR.
>
> While at it, also fix a tab vs space in the surrounding code.
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> Un-compiled and un-tested.
Please at least compile test patches.
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 1/3] clk: keystone: Fix an error checking
@ 2016-11-02 0:22 ` Stephen Boyd
0 siblings, 0 replies; 18+ messages in thread
From: Stephen Boyd @ 2016-11-02 0:22 UTC (permalink / raw)
To: Christophe JAILLET
Cc: lars, dan.carpenter, ssantosh, mturquette, linux-clk,
linux-kernel, kernel-janitors
On 10/24, Christophe JAILLET wrote:
> clk_register_pll() can return ERR_PTR(-ENOMEM) so checking the return value
> against NULL only is not correct.
The code just doesn't propagate the error up to the caller.
Instead the caller treats NULL as an error and non-NULL as valid.
If the callee detects an error it hides it and returns NULL.
> In order to fix it, update clk_register_pll() to always return an error
> pointer in case of error and check the return value with IS_ERR.
>
> While at it, also fix a tab vs space in the surrounding code.
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> Un-compiled and un-tested.
Please at least compile test patches.
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 1/3] clk: keystone: Fix an error checking
2016-11-02 0:22 ` Stephen Boyd
@ 2016-11-04 5:43 ` Christophe JAILLET
-1 siblings, 0 replies; 18+ messages in thread
From: Christophe JAILLET @ 2016-11-04 5:43 UTC (permalink / raw)
To: Stephen Boyd
Cc: lars, dan.carpenter, ssantosh, mturquette, linux-clk,
linux-kernel, kernel-janitors
Le 02/11/2016 à 01:22, Stephen Boyd a écrit :
> On 10/24, Christophe JAILLET wrote:
>> clk_register_pll() can return ERR_PTR(-ENOMEM) so checking the return value
>> against NULL only is not correct.
> The code just doesn't propagate the error up to the caller.
> Instead the caller treats NULL as an error and non-NULL as valid.
> If the callee detects an error it hides it and returns NULL.
Could you please clarify?
I thought that your point was that 'clk_register_pll()' was returning
NULL when 'clk_register()' was returning an error.
The proposed patch fixes it and now 'clk_register_pll()' returns:
- either ERR_PTR(-ENOMEM) if zkalloc fails
- or clk if 'clk_register()' fails. In this case it is an error pointer
- or a valid, non NULL, pointer in case of success
The caller, '_of_pll_clk_init()' has also been updated to test the
return value using IS_ERR.
So, which caller/callee do you refer to?
Would you like '_of_pll_clk_init()' to also propagate the error?
Or is it the phrasing of the log entry which is not clear enough and
should be updated?
>
>> In order to fix it, update clk_register_pll() to always return an error
>> pointer in case of error and check the return value with IS_ERR.
>>
>> While at it, also fix a tab vs space in the surrounding code.
>>
>> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
>> ---
>> Un-compiled and un-tested.
> Please at least compile test patches.
Agreed, and I usually do.
But in this particular case, I don't have the build environment to do it.
I preferred to report what looks like a (small) bug to me and clearly
state that I didn't even compile-tested it rather than just ignoring it.
Hoping that this approach, in such a case, is acceptable.
CJ
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 1/3] clk: keystone: Fix an error checking
@ 2016-11-04 5:43 ` Christophe JAILLET
0 siblings, 0 replies; 18+ messages in thread
From: Christophe JAILLET @ 2016-11-04 5:43 UTC (permalink / raw)
To: Stephen Boyd
Cc: lars, dan.carpenter, ssantosh, mturquette, linux-clk,
linux-kernel, kernel-janitors
Le 02/11/2016 à 01:22, Stephen Boyd a écrit :
> On 10/24, Christophe JAILLET wrote:
>> clk_register_pll() can return ERR_PTR(-ENOMEM) so checking the return value
>> against NULL only is not correct.
> The code just doesn't propagate the error up to the caller.
> Instead the caller treats NULL as an error and non-NULL as valid.
> If the callee detects an error it hides it and returns NULL.
Could you please clarify?
I thought that your point was that 'clk_register_pll()' was returning
NULL when 'clk_register()' was returning an error.
The proposed patch fixes it and now 'clk_register_pll()' returns:
- either ERR_PTR(-ENOMEM) if zkalloc fails
- or clk if 'clk_register()' fails. In this case it is an error pointer
- or a valid, non NULL, pointer in case of success
The caller, '_of_pll_clk_init()' has also been updated to test the
return value using IS_ERR.
So, which caller/callee do you refer to?
Would you like '_of_pll_clk_init()' to also propagate the error?
Or is it the phrasing of the log entry which is not clear enough and
should be updated?
>
>> In order to fix it, update clk_register_pll() to always return an error
>> pointer in case of error and check the return value with IS_ERR.
>>
>> While at it, also fix a tab vs space in the surrounding code.
>>
>> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
>> ---
>> Un-compiled and un-tested.
> Please at least compile test patches.
Agreed, and I usually do.
But in this particular case, I don't have the build environment to do it.
I preferred to report what looks like a (small) bug to me and clearly
state that I didn't even compile-tested it rather than just ignoring it.
Hoping that this approach, in such a case, is acceptable.
CJ
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 18+ messages in thread
end of thread, other threads:[~2016-11-04 5:44 UTC | newest]
Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-24 20:43 [PATCH 0/3] clk: keystone: Fix some error handling paths Christophe JAILLET
2016-10-24 20:43 ` Christophe JAILLET
2016-10-24 20:43 ` [PATCH 1/3] clk: keystone: Fix an error checking Christophe JAILLET
2016-10-24 20:43 ` Christophe JAILLET
2016-11-02 0:22 ` Stephen Boyd
2016-11-02 0:22 ` Stephen Boyd
2016-11-04 5:43 ` Christophe JAILLET
2016-11-04 5:43 ` Christophe JAILLET
2016-10-24 20:43 ` [PATCH 2/3] clk: keystone: Fix some error messages Christophe JAILLET
2016-10-24 20:43 ` Christophe JAILLET
2016-10-24 20:43 ` [PATCH 3/3] clk: keystone: Fix missing iounmap calls in an error handling path Christophe JAILLET
2016-10-24 20:43 ` Christophe JAILLET
2016-10-25 7:08 ` walter harms
2016-10-25 7:08 ` walter harms
2016-10-25 20:35 ` Stephen Boyd
2016-10-25 20:35 ` Stephen Boyd
2016-10-26 12:14 ` walter harms
2016-10-28 0:19 ` Stephen Boyd
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.