Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5028577d authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "drm/msm/dsi-staging: Free memory to prevent memleak"

parents 3ab6b570 79af5d8d
Loading
Loading
Loading
Loading
+12 −8
Original line number Diff line number Diff line
@@ -1559,14 +1559,14 @@ static int dsi_panel_create_cmd_packets(const char *data,
	return rc;
error_free_payloads:
	for (i = i - 1; i >= 0; i--) {
		cmd--;
		kfree(cmd->msg.tx_buf);
		kfree(cmd[i].msg.tx_buf);
		cmd[i].msg.tx_buf = NULL;
	}

	return rc;
}

static void dsi_panel_destroy_cmd_packets(struct dsi_panel_cmd_set *set)
static void dsi_panel_destroy_cmds_packets_buf(struct dsi_panel_cmd_set *set)
{
	u32 i = 0;
	struct dsi_cmd_desc *cmd;
@@ -1574,12 +1574,15 @@ static void dsi_panel_destroy_cmd_packets(struct dsi_panel_cmd_set *set)
	for (i = 0; i < set->count; i++) {
		cmd = &set->cmds[i];
		kfree(cmd->msg.tx_buf);
		cmd->msg.tx_buf = NULL;
	}
}

static void dsi_panel_dealloc_cmd_packets(struct dsi_panel_cmd_set *set)
static void dsi_panel_destroy_cmd_packets(struct dsi_panel_cmd_set *set)
{
	dsi_panel_destroy_cmds_packets_buf(set);
	kfree(set->cmds);
	set->count = 0;
}

static int dsi_panel_alloc_cmd_packets(struct dsi_panel_cmd_set *cmd,
@@ -3163,12 +3166,13 @@ void dsi_panel_put_mode(struct dsi_display_mode *mode)
	if (!mode->priv_info)
		return;

	for (i = 0; i < DSI_CMD_SET_MAX; i++) {
	kfree(mode->priv_info->phy_timing_val);

	for (i = 0; i < DSI_CMD_SET_MAX; i++)
		dsi_panel_destroy_cmd_packets(&mode->priv_info->cmd_sets[i]);
		dsi_panel_dealloc_cmd_packets(&mode->priv_info->cmd_sets[i]);
	}

	kfree(mode->priv_info);
	mode->priv_info = NULL;
}

int dsi_panel_get_mode(struct dsi_panel *panel,
@@ -3370,7 +3374,7 @@ int dsi_panel_update_pps(struct dsi_panel *panel)
			panel->name, rc);
	}

	dsi_panel_destroy_cmd_packets(set);
	dsi_panel_destroy_cmds_packets_buf(set);
error:
	mutex_unlock(&panel->panel_lock);
	return rc;