aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJordan Crouse <jcrouse@codeaurora.org>2018-01-22 13:10:45 -0500
committerRob Clark <robdclark@gmail.com>2018-02-20 10:41:22 -0500
commit9d20a0e6a8f4edf37d75f3bca41f99f52a440c22 (patch)
treef6973d9e446df02bdc5df5fe1e70e328f1fc196b
parentdc9a9b32053efea0a2610be98814519ec59570b4 (diff)
drm/msm/gpu: Set number of clocks to 0 if the list allocation fails
If we fail to allocate gpu->grp_clks reset the number of available clocks to zero to avoid referencing the missing array later. Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org> Signed-off-by: Rob Clark <robdclark@gmail.com>
-rw-r--r--drivers/gpu/drm/msm/msm_gpu.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/gpu/drm/msm/msm_gpu.c b/drivers/gpu/drm/msm/msm_gpu.c
index 8078e4d52fe0..1c09acfb4028 100644
--- a/drivers/gpu/drm/msm/msm_gpu.c
+++ b/drivers/gpu/drm/msm/msm_gpu.c
@@ -682,8 +682,10 @@ static int get_clocks(struct platform_device *pdev, struct msm_gpu *gpu)
682 682
683 gpu->grp_clks = devm_kcalloc(dev, sizeof(struct clk *), gpu->nr_clocks, 683 gpu->grp_clks = devm_kcalloc(dev, sizeof(struct clk *), gpu->nr_clocks,
684 GFP_KERNEL); 684 GFP_KERNEL);
685 if (!gpu->grp_clks) 685 if (!gpu->grp_clks) {
686 gpu->nr_clocks = 0;
686 return -ENOMEM; 687 return -ENOMEM;
688 }
687 689
688 of_property_for_each_string(dev->of_node, "clock-names", prop, name) { 690 of_property_for_each_string(dev->of_node, "clock-names", prop, name) {
689 gpu->grp_clks[i] = get_clock(dev, name); 691 gpu->grp_clks[i] = get_clock(dev, name);