From 70a1445d185d3fdf5136e868166dd55faab3d7a9 Mon Sep 17 00:00:00 2001 From: Samantha Tran Date: Tue, 24 Sep 2019 11:18:11 -0700 Subject: [PATCH] disp: msm: dsi: add null check for panel and proper ctrl iteration This change moves the panel null check to the beginning of the function so panel can be used throughout the function. This change also replaces looping through display ctrls with proper display_for_each_ctrl. Change-Id: I0014ee7ad6d8514734f9233a1abb314e60d29b5f Signed-off-by: Samantha Tran --- msm/dsi/dsi_display.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/msm/dsi/dsi_display.c b/msm/dsi/dsi_display.c index 97826d3f1fad..5c1eec53816a 100644 --- a/msm/dsi/dsi_display.c +++ b/msm/dsi/dsi_display.c @@ -4064,7 +4064,7 @@ static int dsi_display_dynamic_clk_switch_vid(struct dsi_display *display, dsi_display_mask_ctrl_error_interrupts(display, mask, true); /* update the phy timings based on new mode */ - for (i = 0; i < display->ctrl_count; i++) { + display_for_each_ctrl(i, display) { ctrl = &display->ctrl[i]; dsi_phy_update_phy_timings(ctrl->phy, &display->config); } @@ -4084,7 +4084,7 @@ static int dsi_display_dynamic_clk_switch_vid(struct dsi_display *display, _dsi_display_calc_pipe_delay(display, &delay, mode); /* configure dynamic refresh ctrl registers */ - for (i = 0; i < display->ctrl_count; i++) { + display_for_each_ctrl(i, display) { ctrl = &display->ctrl[i]; if (!ctrl->phy) continue; @@ -5997,14 +5997,14 @@ int dsi_display_get_panel_vfp(void *dsi_display, struct dsi_display *display = (struct dsi_display *)dsi_display; struct dsi_host_common_cfg *host; - if (!display) + if (!display || !display->panel) return -EINVAL; mutex_lock(&display->display_lock); count = display->panel->num_display_modes; - if (display->panel && display->panel->cur_mode) + if (display->panel->cur_mode) refresh_rate = display->panel->cur_mode->timing.refresh_rate; dsi_panel_get_dfps_caps(display->panel, &dfps_caps);