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

Commit 2d0ed4bb authored by Ujwal Patel's avatar Ujwal Patel Committed by Gerrit - the friendly Code Review server
Browse files

msm: mdss: replace kmalloc with kzalloc wherever appropriate



Currently different drivers within MDSS, allocate dynamic memory using
kmalloc and then use explicit memset to zero out the content. Instead use
kzalloc API to achieve the same.

Change-Id: I09d3d5e5986206f90c97d4d04fc3a855c233a7ae
Signed-off-by: default avatarUjwal Patel <ujwalp@codeaurora.org>
parent 8a4a06ec
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -540,7 +540,7 @@ void dsi_register_interface(struct dsi_interface *intf)

int dsi_buf_alloc(struct dsi_buf *dp, int size)
{
	dp->start = kmalloc(size, GFP_KERNEL);
	dp->start = kzalloc(size, GFP_KERNEL);
	if (dp->start == NULL) {
		pr_err("%s:%u\n", __func__, __LINE__);
		return -ENOMEM;
+1 −2
Original line number Diff line number Diff line
@@ -1837,12 +1837,11 @@ int mdp3_ctrl_init(struct msm_fb_data_type *mfd)
	mdp3_interface->kickoff_fnc = mdp3_ctrl_display_commit_kickoff;
	mdp3_interface->lut_update = mdp3_ctrl_lut_update;

	mdp3_session = kmalloc(sizeof(struct mdp3_session_data), GFP_KERNEL);
	mdp3_session = kzalloc(sizeof(struct mdp3_session_data), GFP_KERNEL);
	if (!mdp3_session) {
		pr_err("fail to allocate mdp3 private data structure");
		return -ENOMEM;
	}
	memset(mdp3_session, 0, sizeof(struct mdp3_session_data));
	mutex_init(&mdp3_session->lock);
	INIT_WORK(&mdp3_session->clk_off_work, mdp3_dispatch_clk_off);
	INIT_WORK(&mdp3_session->dma_done_work, mdp3_dispatch_dma_done);
+1 −1
Original line number Diff line number Diff line
@@ -1226,7 +1226,7 @@ int mdp3_ppp_res_init(struct msm_fb_data_type *mfd)
	const char timeline_name[] = "mdp3_ppp";
	ppp_stat = kzalloc(sizeof(struct ppp_status), GFP_KERNEL);
	if (!ppp_stat) {
		pr_err("%s: kmalloc failed\n", __func__);
		pr_err("%s: kzalloc failed\n", __func__);
		return -ENOMEM;
	}

+1 −2
Original line number Diff line number Diff line
@@ -3474,12 +3474,11 @@ int mdss_mdp_overlay_init(struct msm_fb_data_type *mfd)
	mdp5_interface->get_sync_fnc = mdss_mdp_rotator_sync_pt_get;
	mdp5_interface->splash_fnc = mdss_mdp_overlay_splash_image;

	mdp5_data = kmalloc(sizeof(struct mdss_overlay_private), GFP_KERNEL);
	mdp5_data = kzalloc(sizeof(struct mdss_overlay_private), GFP_KERNEL);
	if (!mdp5_data) {
		pr_err("fail to allocate mdp5 private data structure");
		return -ENOMEM;
	}
	memset(mdp5_data, 0, sizeof(struct mdss_overlay_private));

	INIT_LIST_HEAD(&mdp5_data->pipes_used);
	INIT_LIST_HEAD(&mdp5_data->pipes_cleanup);
+2 −5
Original line number Diff line number Diff line
@@ -3694,13 +3694,12 @@ int mdss_mdp_hist_collect(struct mdp_histogram_data *hist)
			goto hist_collect_exit;
		}
		if (hist_cnt > 1) {
			hist_concat = kmalloc(HIST_V_SIZE * sizeof(u32),
			hist_concat = kzalloc(HIST_V_SIZE * sizeof(u32),
								GFP_KERNEL);
			if (!hist_concat) {
				ret = -ENOMEM;
				goto hist_collect_exit;
			}
			memset(hist_concat, 0, HIST_V_SIZE * sizeof(u32));
			for (i = 0; i < hist_cnt; i++) {
				mutex_lock(&hists[i]->hist_mutex);
				for (j = 0; j < HIST_V_SIZE; j++)
@@ -3806,15 +3805,13 @@ int mdss_mdp_hist_collect(struct mdp_histogram_data *hist)
			goto hist_collect_exit;
		}
		if (pipe_cnt > 1) {
			hist_concat = kmalloc(HIST_V_SIZE * pipe_cnt *
			hist_concat = kzalloc(HIST_V_SIZE * pipe_cnt *
						sizeof(u32), GFP_KERNEL);
			if (!hist_concat) {
				ret = -ENOMEM;
				goto hist_collect_exit;
			}

			memset(hist_concat, 0, pipe_cnt * HIST_V_SIZE *
								sizeof(u32));
			for (i = pipe_num; i < MDSS_PP_ARG_NUM; i++) {
				if (!PP_ARG(i, hist->block))
					continue;