disp: msm: dsi: use dynamic memory allocation for dsi_display_mode_priv_info variable
This change adds dynamic memory allocation/free for struct dsi_display_mode_priv_info variable as it is only temporary variable to find mode and also reduces stack consumption in dsi_display_find_mode function. Change-Id: I2116757f11614f9e8406ddfdb08b5a4b6292cfea Signed-off-by: Yashwanth <yvulapu@codeaurora.org>
This commit is contained in:

committed by
Gerrit - the friendly Code Review server

parent
bae72f6a9b
commit
981508c215
@@ -7150,7 +7150,7 @@ int dsi_display_find_mode(struct dsi_display *display,
|
|||||||
struct dsi_display_mode *m;
|
struct dsi_display_mode *m;
|
||||||
struct dsi_dyn_clk_caps *dyn_clk_caps;
|
struct dsi_dyn_clk_caps *dyn_clk_caps;
|
||||||
unsigned int match_flags = DSI_MODE_MATCH_FULL_TIMINGS;
|
unsigned int match_flags = DSI_MODE_MATCH_FULL_TIMINGS;
|
||||||
struct dsi_display_mode_priv_info priv_info;
|
struct dsi_display_mode_priv_info *priv_info;
|
||||||
|
|
||||||
if (!display || !out_mode)
|
if (!display || !out_mode)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
@@ -7167,6 +7167,10 @@ int dsi_display_find_mode(struct dsi_display *display,
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
priv_info = kzalloc(sizeof(struct dsi_display_mode_priv_info), GFP_KERNEL);
|
||||||
|
if (ZERO_OR_NULL_PTR(priv_info))
|
||||||
|
return -ENOMEM;
|
||||||
|
|
||||||
mutex_lock(&display->display_lock);
|
mutex_lock(&display->display_lock);
|
||||||
dyn_clk_caps = &(display->panel->dyn_clk_caps);
|
dyn_clk_caps = &(display->panel->dyn_clk_caps);
|
||||||
for (i = 0; i < count; i++) {
|
for (i = 0; i < count; i++) {
|
||||||
@@ -7183,9 +7187,7 @@ int dsi_display_find_mode(struct dsi_display *display,
|
|||||||
|
|
||||||
if (sub_mode && sub_mode->dsc_mode) {
|
if (sub_mode && sub_mode->dsc_mode) {
|
||||||
match_flags |= DSI_MODE_MATCH_DSC_CONFIG;
|
match_flags |= DSI_MODE_MATCH_DSC_CONFIG;
|
||||||
cmp->priv_info = &priv_info;
|
cmp->priv_info = priv_info;
|
||||||
memset(cmp->priv_info, 0,
|
|
||||||
sizeof(struct dsi_display_mode_priv_info));
|
|
||||||
cmp->priv_info->dsc_enabled = (sub_mode->dsc_mode ==
|
cmp->priv_info->dsc_enabled = (sub_mode->dsc_mode ==
|
||||||
MSM_DISPLAY_DSC_MODE_ENABLED) ? true : false;
|
MSM_DISPLAY_DSC_MODE_ENABLED) ? true : false;
|
||||||
}
|
}
|
||||||
@@ -7200,6 +7202,7 @@ int dsi_display_find_mode(struct dsi_display *display,
|
|||||||
cmp->priv_info = NULL;
|
cmp->priv_info = NULL;
|
||||||
|
|
||||||
mutex_unlock(&display->display_lock);
|
mutex_unlock(&display->display_lock);
|
||||||
|
kfree(priv_info);
|
||||||
|
|
||||||
if (!*out_mode) {
|
if (!*out_mode) {
|
||||||
DSI_ERR("[%s] failed to find mode for v_active %u h_active %u fps %u pclk %u\n",
|
DSI_ERR("[%s] failed to find mode for v_active %u h_active %u fps %u pclk %u\n",
|
||||||
|
Reference in New Issue
Block a user