* [PATCH] bus: ti-sysc: Fix handling of invalid clocks
@ 2019-09-05 21:53 Tony Lindgren
2019-09-06 7:39 ` Roger Quadros
2019-09-06 7:49 ` Keerthy
0 siblings, 2 replies; 3+ messages in thread
From: Tony Lindgren @ 2019-09-05 21:53 UTC (permalink / raw)
To: linux-omap
Cc: Nishanth Menon, Tero Kristo, Dave Gerlach, Keerthy, linux-kernel,
Andrew F . Davis, Peter Ujfalusi, Faiz Abbas, Greg Kroah-Hartman,
linux-arm-kernel, Roger Quadros
We can currently get "Unable to handle kernel paging request at
virtual address" for invalid clocks with dts node but no driver:
(__clk_get_hw) from [<c0138ebc>] (ti_sysc_find_one_clockdomain+0x18/0x34)
(ti_sysc_find_one_clockdomain) from [<c0138f0c>] (ti_sysc_clkdm_init+0x34/0xdc)
(ti_sysc_clkdm_init) from [<c0584660>] (sysc_probe+0xa50/0x10e8)
(sysc_probe) from [<c065c6ac>] (platform_drv_probe+0x58/0xa8)
Let's add IS_ERR checks to ti_sysc_clkdm_init() as And let's start treating
clk_get() with -ENOENT as a proper error. If the clock name is specified
in device tree we must succeed with clk_get() to continue. For modules with
no clock names specified in device tree we will just ignore the clocks.
Fixes: 2b2f7def058a ("bus: ti-sysc: Add support for missing clockdomain handling")
Signed-off-by: Tony Lindgren <tony@atomide.com>
---
arch/arm/mach-omap2/pdata-quirks.c | 4 ++--
drivers/bus/ti-sysc.c | 5 +----
2 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/arch/arm/mach-omap2/pdata-quirks.c b/arch/arm/mach-omap2/pdata-quirks.c
--- a/arch/arm/mach-omap2/pdata-quirks.c
+++ b/arch/arm/mach-omap2/pdata-quirks.c
@@ -491,11 +491,11 @@ static int ti_sysc_clkdm_init(struct device *dev,
struct clk *fck, struct clk *ick,
struct ti_sysc_cookie *cookie)
{
- if (fck)
+ if (!IS_ERR(fck))
cookie->clkdm = ti_sysc_find_one_clockdomain(fck);
if (cookie->clkdm)
return 0;
- if (ick)
+ if (!IS_ERR(ick))
cookie->clkdm = ti_sysc_find_one_clockdomain(ick);
if (cookie->clkdm)
return 0;
diff --git a/drivers/bus/ti-sysc.c b/drivers/bus/ti-sysc.c
--- a/drivers/bus/ti-sysc.c
+++ b/drivers/bus/ti-sysc.c
@@ -280,9 +280,6 @@ static int sysc_get_one_clock(struct sysc *ddata, const char *name)
ddata->clocks[index] = devm_clk_get(ddata->dev, name);
if (IS_ERR(ddata->clocks[index])) {
- if (PTR_ERR(ddata->clocks[index]) == -ENOENT)
- return 0;
-
dev_err(ddata->dev, "clock get error for %s: %li\n",
name, PTR_ERR(ddata->clocks[index]));
@@ -357,7 +354,7 @@ static int sysc_get_clocks(struct sysc *ddata)
continue;
error = sysc_get_one_clock(ddata, name);
- if (error && error != -ENOENT)
+ if (error)
return error;
}
--
2.23.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] bus: ti-sysc: Fix handling of invalid clocks
2019-09-05 21:53 [PATCH] bus: ti-sysc: Fix handling of invalid clocks Tony Lindgren
@ 2019-09-06 7:39 ` Roger Quadros
2019-09-06 7:49 ` Keerthy
1 sibling, 0 replies; 3+ messages in thread
From: Roger Quadros @ 2019-09-06 7:39 UTC (permalink / raw)
To: Tony Lindgren, linux-omap
Cc: Nishanth Menon, Tero Kristo, Dave Gerlach, Keerthy, linux-kernel,
Andrew F . Davis, Peter Ujfalusi, Faiz Abbas, Greg Kroah-Hartman,
linux-arm-kernel
On 06/09/2019 00:53, Tony Lindgren wrote:
> We can currently get "Unable to handle kernel paging request at
> virtual address" for invalid clocks with dts node but no driver:
>
> (__clk_get_hw) from [<c0138ebc>] (ti_sysc_find_one_clockdomain+0x18/0x34)
> (ti_sysc_find_one_clockdomain) from [<c0138f0c>] (ti_sysc_clkdm_init+0x34/0xdc)
> (ti_sysc_clkdm_init) from [<c0584660>] (sysc_probe+0xa50/0x10e8)
> (sysc_probe) from [<c065c6ac>] (platform_drv_probe+0x58/0xa8)
>
> Let's add IS_ERR checks to ti_sysc_clkdm_init() as And let's start treating
> clk_get() with -ENOENT as a proper error. If the clock name is specified
> in device tree we must succeed with clk_get() to continue. For modules with
> no clock names specified in device tree we will just ignore the clocks.
>
> Fixes: 2b2f7def058a ("bus: ti-sysc: Add support for missing clockdomain handling")
> Signed-off-by: Tony Lindgren <tony@atomide.com>
Acked-by: Roger Quadros <rogerq@ti.com>
> ---
> arch/arm/mach-omap2/pdata-quirks.c | 4 ++--
> drivers/bus/ti-sysc.c | 5 +----
> 2 files changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/pdata-quirks.c b/arch/arm/mach-omap2/pdata-quirks.c
> --- a/arch/arm/mach-omap2/pdata-quirks.c
> +++ b/arch/arm/mach-omap2/pdata-quirks.c
> @@ -491,11 +491,11 @@ static int ti_sysc_clkdm_init(struct device *dev,
> struct clk *fck, struct clk *ick,
> struct ti_sysc_cookie *cookie)
> {
> - if (fck)
> + if (!IS_ERR(fck))
> cookie->clkdm = ti_sysc_find_one_clockdomain(fck);
> if (cookie->clkdm)
> return 0;
> - if (ick)
> + if (!IS_ERR(ick))
> cookie->clkdm = ti_sysc_find_one_clockdomain(ick);
> if (cookie->clkdm)
> return 0;
> diff --git a/drivers/bus/ti-sysc.c b/drivers/bus/ti-sysc.c
> --- a/drivers/bus/ti-sysc.c
> +++ b/drivers/bus/ti-sysc.c
> @@ -280,9 +280,6 @@ static int sysc_get_one_clock(struct sysc *ddata, const char *name)
>
> ddata->clocks[index] = devm_clk_get(ddata->dev, name);
> if (IS_ERR(ddata->clocks[index])) {
> - if (PTR_ERR(ddata->clocks[index]) == -ENOENT)
> - return 0;
> -
> dev_err(ddata->dev, "clock get error for %s: %li\n",
> name, PTR_ERR(ddata->clocks[index]));
>
> @@ -357,7 +354,7 @@ static int sysc_get_clocks(struct sysc *ddata)
> continue;
>
> error = sysc_get_one_clock(ddata, name);
> - if (error && error != -ENOENT)
> + if (error)
> return error;
> }
>
>
--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] bus: ti-sysc: Fix handling of invalid clocks
2019-09-05 21:53 [PATCH] bus: ti-sysc: Fix handling of invalid clocks Tony Lindgren
2019-09-06 7:39 ` Roger Quadros
@ 2019-09-06 7:49 ` Keerthy
1 sibling, 0 replies; 3+ messages in thread
From: Keerthy @ 2019-09-06 7:49 UTC (permalink / raw)
To: Tony Lindgren, linux-omap
Cc: Nishanth Menon, Tero Kristo, Dave Gerlach, Greg Kroah-Hartman,
linux-kernel, Andrew F . Davis, Peter Ujfalusi, Faiz Abbas,
linux-arm-kernel, Roger Quadros
On 06/09/19 3:23 AM, Tony Lindgren wrote:
> We can currently get "Unable to handle kernel paging request at
> virtual address" for invalid clocks with dts node but no driver:
>
> (__clk_get_hw) from [<c0138ebc>] (ti_sysc_find_one_clockdomain+0x18/0x34)
> (ti_sysc_find_one_clockdomain) from [<c0138f0c>] (ti_sysc_clkdm_init+0x34/0xdc)
> (ti_sysc_clkdm_init) from [<c0584660>] (sysc_probe+0xa50/0x10e8)
> (sysc_probe) from [<c065c6ac>] (platform_drv_probe+0x58/0xa8)
>
> Let's add IS_ERR checks to ti_sysc_clkdm_init() as And let's start treating
> clk_get() with -ENOENT as a proper error. If the clock name is specified
> in device tree we must succeed with clk_get() to continue. For modules with
> no clock names specified in device tree we will just ignore the clocks.
Tested for DS0 and RTC+DDR modes on AM437x
FWIW
Tested-by: Keerthy <j-keerthy@ti.com>
>
> Fixes: 2b2f7def058a ("bus: ti-sysc: Add support for missing clockdomain handling")
> Signed-off-by: Tony Lindgren <tony@atomide.com>
> ---
> arch/arm/mach-omap2/pdata-quirks.c | 4 ++--
> drivers/bus/ti-sysc.c | 5 +----
> 2 files changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/pdata-quirks.c b/arch/arm/mach-omap2/pdata-quirks.c
> --- a/arch/arm/mach-omap2/pdata-quirks.c
> +++ b/arch/arm/mach-omap2/pdata-quirks.c
> @@ -491,11 +491,11 @@ static int ti_sysc_clkdm_init(struct device *dev,
> struct clk *fck, struct clk *ick,
> struct ti_sysc_cookie *cookie)
> {
> - if (fck)
> + if (!IS_ERR(fck))
> cookie->clkdm = ti_sysc_find_one_clockdomain(fck);
> if (cookie->clkdm)
> return 0;
> - if (ick)
> + if (!IS_ERR(ick))
> cookie->clkdm = ti_sysc_find_one_clockdomain(ick);
> if (cookie->clkdm)
> return 0;
> diff --git a/drivers/bus/ti-sysc.c b/drivers/bus/ti-sysc.c
> --- a/drivers/bus/ti-sysc.c
> +++ b/drivers/bus/ti-sysc.c
> @@ -280,9 +280,6 @@ static int sysc_get_one_clock(struct sysc *ddata, const char *name)
>
> ddata->clocks[index] = devm_clk_get(ddata->dev, name);
> if (IS_ERR(ddata->clocks[index])) {
> - if (PTR_ERR(ddata->clocks[index]) == -ENOENT)
> - return 0;
> -
> dev_err(ddata->dev, "clock get error for %s: %li\n",
> name, PTR_ERR(ddata->clocks[index]));
>
> @@ -357,7 +354,7 @@ static int sysc_get_clocks(struct sysc *ddata)
> continue;
>
> error = sysc_get_one_clock(ddata, name);
> - if (error && error != -ENOENT)
> + if (error)
> return error;
> }
>
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-09-06 7:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-09-05 21:53 [PATCH] bus: ti-sysc: Fix handling of invalid clocks Tony Lindgren
2019-09-06 7:39 ` Roger Quadros
2019-09-06 7:49 ` Keerthy
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).