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

Commit 1770bb98 authored by Narendra Muppalla's avatar Narendra Muppalla Committed by Gerrit - the friendly Code Review server
Browse files

drm/msm: add pointer check before dereference



Add pointer check, print error message and return
error value in case the pointer is NULL. Also this change
uses connector iterator to go through the list of connectors
in the mode_config.

Change-Id: I9b776bfce771148606548a41cab6a695fc2adfa7
Signed-off-by: default avatarShubhashree Dhar <dhar@codeaurora.org>
Signed-off-by: default avatarNarendra Muppalla <NarendraM@codeaurora.org>
parent 0db88144
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -1370,10 +1370,17 @@ static int dsi_message_rx(struct dsi_ctrl *dsi_ctrl,
	u32 current_read_len = 0, total_bytes_read = 0;
	bool short_resp = false;
	bool read_done = false;
	u32 dlen, diff, rlen = msg->rx_len;
	u32 dlen, diff, rlen;
	unsigned char *buff;
	char cmd;

	if (!msg) {
		pr_err("Invalid msg\n");
		rc = -EINVAL;
		goto error;
	}

	rlen = msg->rx_len;
	if (msg->rx_len <= 2) {
		short_resp = true;
		rd_pkt_size = msg->rx_len;
+9 −12
Original line number Diff line number Diff line
@@ -2291,8 +2291,7 @@ static int sde_kms_cont_splash_config(struct msm_kms *kms)
	struct drm_device *dev;
	struct msm_drm_private *priv;
	struct sde_kms *sde_kms;
	struct list_head *connector_list = NULL;
	struct drm_connector *conn_iter = NULL;
	struct drm_connector_list_iter conn_iter;
	struct drm_connector *connector = NULL;
	struct sde_connector *sde_conn = NULL;

@@ -2349,21 +2348,19 @@ static int sde_kms_cont_splash_config(struct msm_kms *kms)


	mutex_lock(&dev->mode_config.mutex);
	connector_list = &dev->mode_config.connector_list;
	list_for_each_entry(conn_iter, connector_list, head) {
	drm_connector_list_iter_begin(dev, &conn_iter);
	drm_for_each_connector_iter(connector, &conn_iter) {
		/**
		 * SDE_KMS doesn't attach more than one encoder to
		 * a DSI connector. So it is safe to check only with the
		 * first encoder entry. Revisit this logic if we ever have
		 * to support continuous splash for external displays in MST
		 * configuration.
		 * a DSI connector. So it is safe to check only with
		 * the first encoder entry. Revisit this logic if we
		 * ever have to support continuous splash for
		 * external displays in MST configuration.
		 */
		if (conn_iter &&
			(conn_iter->encoder_ids[0] == encoder->base.id)) {
			connector = conn_iter;
		if (connector->encoder_ids[0] == encoder->base.id)
			break;
	}
	}
	drm_connector_list_iter_end(&conn_iter);

	if (!connector) {
		SDE_ERROR("connector not initialized\n");