Commit 2783d0638a51e8dba6319d9f4a2b445995a4fad1

Authored by Tony Lindgren
1 parent d098913a10

bus: ti-sysc: Fix handling of invalid clocks

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")
Acked-by: Roger Quadros <rogerq@ti.com>
Tested-by: Keerthy <j-keerthy@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>

Showing 2 changed files with 3 additions and 6 deletions Side-by-side Diff

arch/arm/mach-omap2/pdata-quirks.c
... ... @@ -491,11 +491,11 @@
491 491 struct clk *fck, struct clk *ick,
492 492 struct ti_sysc_cookie *cookie)
493 493 {
494   - if (fck)
  494 + if (!IS_ERR(fck))
495 495 cookie->clkdm = ti_sysc_find_one_clockdomain(fck);
496 496 if (cookie->clkdm)
497 497 return 0;
498   - if (ick)
  498 + if (!IS_ERR(ick))
499 499 cookie->clkdm = ti_sysc_find_one_clockdomain(ick);
500 500 if (cookie->clkdm)
501 501 return 0;
drivers/bus/ti-sysc.c
... ... @@ -280,9 +280,6 @@
280 280  
281 281 ddata->clocks[index] = devm_clk_get(ddata->dev, name);
282 282 if (IS_ERR(ddata->clocks[index])) {
283   - if (PTR_ERR(ddata->clocks[index]) == -ENOENT)
284   - return 0;
285   -
286 283 dev_err(ddata->dev, "clock get error for %s: %li\n",
287 284 name, PTR_ERR(ddata->clocks[index]));
288 285  
... ... @@ -357,7 +354,7 @@
357 354 continue;
358 355  
359 356 error = sysc_get_one_clock(ddata, name);
360   - if (error && error != -ENOENT)
  357 + if (error)
361 358 return error;
362 359 }
363 360