diff options
author | Tony Lindgren <tony@atomide.com> | 2017-10-16 17:06:14 -0400 |
---|---|---|
committer | Wolfram Sang <wsa@the-dreams.de> | 2017-10-17 18:19:26 -0400 |
commit | 883b3b6567bfc8b5da7b3f0cec80513af111d2f5 (patch) | |
tree | ec468043d0aca390acac39a1488e4b83ddf9e4c2 | |
parent | 88fa2dfb075a20c3464e3d303c57dd8ced9e8309 (diff) |
i2c: omap: Fix error handling for clk_get()
Otherwise we can get the following if the fck alias is missing:
Unable to handle kernel paging request at virtual address fffffffe
...
PC is at clk_get_rate+0x8/0x10
LR is at omap_i2c_probe+0x278/0x6ec
...
[<c056eb08>] (clk_get_rate) from [<c06f4f08>] (omap_i2c_probe+0x278/0x6ec)
[<c06f4f08>] (omap_i2c_probe) from [<c0610944>] (platform_drv_probe+0x50/0xb0)
[<c0610944>] (platform_drv_probe) from [<c060e900>] (driver_probe_device+0x264/0x2ec)
[<c060e900>] (driver_probe_device) from [<c060cda0>] (bus_for_each_drv+0x70/0xb8)
[<c060cda0>] (bus_for_each_drv) from [<c060e5b0>] (__device_attach+0xcc/0x13c)
[<c060e5b0>] (__device_attach) from [<c060db10>] (bus_probe_device+0x88/0x90)
[<c060db10>] (bus_probe_device) from [<c060df68>] (deferred_probe_work_func+0x4c/0x14c)
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
-rw-r--r-- | drivers/i2c/busses/i2c-omap.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c index 1ebb5e947e0b..23c2ea2baedc 100644 --- a/drivers/i2c/busses/i2c-omap.c +++ b/drivers/i2c/busses/i2c-omap.c | |||
@@ -360,6 +360,7 @@ static int omap_i2c_init(struct omap_i2c_dev *omap) | |||
360 | unsigned long fclk_rate = 12000000; | 360 | unsigned long fclk_rate = 12000000; |
361 | unsigned long internal_clk = 0; | 361 | unsigned long internal_clk = 0; |
362 | struct clk *fclk; | 362 | struct clk *fclk; |
363 | int error; | ||
363 | 364 | ||
364 | if (omap->rev >= OMAP_I2C_REV_ON_3430_3530) { | 365 | if (omap->rev >= OMAP_I2C_REV_ON_3430_3530) { |
365 | /* | 366 | /* |
@@ -378,6 +379,13 @@ static int omap_i2c_init(struct omap_i2c_dev *omap) | |||
378 | * do this bit unconditionally. | 379 | * do this bit unconditionally. |
379 | */ | 380 | */ |
380 | fclk = clk_get(omap->dev, "fck"); | 381 | fclk = clk_get(omap->dev, "fck"); |
382 | if (IS_ERR(fclk)) { | ||
383 | error = PTR_ERR(fclk); | ||
384 | dev_err(omap->dev, "could not get fck: %i\n", error); | ||
385 | |||
386 | return error; | ||
387 | } | ||
388 | |||
381 | fclk_rate = clk_get_rate(fclk); | 389 | fclk_rate = clk_get_rate(fclk); |
382 | clk_put(fclk); | 390 | clk_put(fclk); |
383 | 391 | ||
@@ -410,6 +418,12 @@ static int omap_i2c_init(struct omap_i2c_dev *omap) | |||
410 | else | 418 | else |
411 | internal_clk = 4000; | 419 | internal_clk = 4000; |
412 | fclk = clk_get(omap->dev, "fck"); | 420 | fclk = clk_get(omap->dev, "fck"); |
421 | if (IS_ERR(fclk)) { | ||
422 | error = PTR_ERR(fclk); | ||
423 | dev_err(omap->dev, "could not get fck: %i\n", error); | ||
424 | |||
425 | return error; | ||
426 | } | ||
413 | fclk_rate = clk_get_rate(fclk) / 1000; | 427 | fclk_rate = clk_get_rate(fclk) / 1000; |
414 | clk_put(fclk); | 428 | clk_put(fclk); |
415 | 429 | ||