Skip to content

Commit 2783d06

Browse files
committed
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: 2b2f7de ("bus: ti-sysc: Add support for missing clockdomain handling") Acked-by: Roger Quadros <[email protected]> Tested-by: Keerthy <[email protected]> Signed-off-by: Tony Lindgren <[email protected]>
1 parent d098913 commit 2783d06

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

arch/arm/mach-omap2/pdata-quirks.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -491,11 +491,11 @@ static int ti_sysc_clkdm_init(struct device *dev,
491491
struct clk *fck, struct clk *ick,
492492
struct ti_sysc_cookie *cookie)
493493
{
494-
if (fck)
494+
if (!IS_ERR(fck))
495495
cookie->clkdm = ti_sysc_find_one_clockdomain(fck);
496496
if (cookie->clkdm)
497497
return 0;
498-
if (ick)
498+
if (!IS_ERR(ick))
499499
cookie->clkdm = ti_sysc_find_one_clockdomain(ick);
500500
if (cookie->clkdm)
501501
return 0;

drivers/bus/ti-sysc.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -280,9 +280,6 @@ static int sysc_get_one_clock(struct sysc *ddata, const char *name)
280280

281281
ddata->clocks[index] = devm_clk_get(ddata->dev, name);
282282
if (IS_ERR(ddata->clocks[index])) {
283-
if (PTR_ERR(ddata->clocks[index]) == -ENOENT)
284-
return 0;
285-
286283
dev_err(ddata->dev, "clock get error for %s: %li\n",
287284
name, PTR_ERR(ddata->clocks[index]));
288285

@@ -357,7 +354,7 @@ static int sysc_get_clocks(struct sysc *ddata)
357354
continue;
358355

359356
error = sysc_get_one_clock(ddata, name);
360-
if (error && error != -ENOENT)
357+
if (error)
361358
return error;
362359
}
363360

0 commit comments

Comments
 (0)