Douglas Anderson 908b050114 clk: qcom: rcg2: Don't crash if our parent can't be found; return an error
When I got my clock parenting slightly wrong I ended up with a crash
that looked like this:

  Unable to handle kernel NULL pointer dereference at virtual
  address 0000000000000000
  ...
  pc : clk_hw_get_rate+0x14/0x44
  ...
  Call trace:
   clk_hw_get_rate+0x14/0x44
   _freq_tbl_determine_rate+0x94/0xfc
   clk_rcg2_determine_rate+0x2c/0x38
   clk_core_determine_round_nolock+0x4c/0x88
   clk_core_round_rate_nolock+0x6c/0xa8
   clk_core_round_rate_nolock+0x9c/0xa8
   clk_core_set_rate_nolock+0x70/0x180
   clk_set_rate+0x3c/0x6c
   of_clk_set_defaults+0x254/0x360
   platform_drv_probe+0x28/0xb0
   really_probe+0x120/0x2dc
   driver_probe_device+0x64/0xfc
   device_driver_attach+0x4c/0x6c
   __driver_attach+0xac/0xc0
   bus_for_each_dev+0x84/0xcc
   driver_attach+0x2c/0x38
   bus_add_driver+0xfc/0x1d0
   driver_register+0x64/0xf8
   __platform_driver_register+0x4c/0x58
   msm_drm_register+0x5c/0x60
   ...

It turned out that clk_hw_get_parent_by_index() was returning NULL and
we weren't checking.  Let's check it so that we don't crash.

Fixes: ac269395cdd8 ("clk: qcom: Convert to clk_hw based provider APIs")
Signed-off-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Matthias Kaehlcke <mka@chromium.org>
Link: https://lkml.kernel.org/r/20200203103049.v4.1.I7487325fe8e701a68a07d3be8a6a4b571eca9cfa@changeid
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
2020-02-03 23:04:02 -08:00
..
2019-12-04 10:56:35 -08:00
2019-12-03 13:58:22 -08:00
2019-12-05 11:43:31 -08:00
2019-12-07 14:49:20 -08:00
2019-12-06 10:28:09 -08:00
2019-12-01 18:43:25 -08:00
2019-11-22 11:16:26 +05:30
2019-12-03 14:37:12 -08:00
2019-12-03 13:58:22 -08:00
2019-12-03 13:58:22 -08:00
2019-11-30 14:35:43 -08:00
2019-12-01 18:42:02 -08:00
2019-12-06 08:28:51 -08:00
2019-12-03 13:58:22 -08:00
2019-12-03 14:37:12 -08:00
2019-11-27 11:06:20 -08:00
2019-12-03 14:09:14 -08:00
2019-12-01 18:43:25 -08:00
2019-12-03 13:58:22 -08:00
2019-12-05 11:43:31 -08:00
2019-12-02 11:41:35 -08:00
2019-11-25 19:40:40 -08:00
2019-12-03 13:58:22 -08:00
2019-12-05 11:43:31 -08:00
2019-12-03 14:37:12 -08:00
2019-12-05 11:28:14 -08:00
2019-12-05 11:43:31 -08:00
2019-12-01 18:39:24 -08:00
2019-12-03 13:31:08 -08:00
2019-12-08 12:23:42 -08:00
2019-12-06 14:19:37 -08:00
2019-11-22 19:56:35 +00:00
2019-12-03 13:58:22 -08:00
2019-12-02 13:37:02 -08:00
2019-12-05 13:18:54 -08:00
2019-12-03 14:09:14 -08:00
2019-12-07 14:51:04 -08:00
2019-12-03 13:58:22 -08:00
2019-11-20 02:15:57 -05:00
2019-11-14 13:06:33 +08:00
2019-12-01 18:01:03 -08:00
2019-12-07 14:49:20 -08:00