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

Commit ab30123f 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: fix potential NULL pointer dereference"

parents 0fcfb086 e4cf6c84
Loading
Loading
Loading
Loading
+13 −12
Original line number Diff line number Diff line
/*
 * Copyright (c) 2015, The Linux Foundation. All rights reserved.
 * Copyright (c) 2015, 2018 The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -193,6 +193,9 @@ int msm_dsi_modeset_init(struct msm_dsi *msm_dsi, struct drm_device *dev,
	struct drm_bridge *ext_bridge;
	int ret, i;

	if (!msm_dsi)
		return -EINVAL;

	if (WARN_ON(!encoders[MSM_DSI_VIDEO_ENCODER_ID] ||
		!encoders[MSM_DSI_CMD_ENCODER_ID]))
		return -EINVAL;
@@ -246,7 +249,6 @@ int msm_dsi_modeset_init(struct msm_dsi *msm_dsi, struct drm_device *dev,

	return 0;
fail:
	if (msm_dsi) {
	/* bridge/connector are normally destroyed by drm: */
	if (msm_dsi->bridge) {
		msm_dsi_manager_bridge_destroy(msm_dsi->bridge);
@@ -258,7 +260,6 @@ fail:
		msm_dsi->connector->funcs->destroy(msm_dsi->connector);

	msm_dsi->connector = NULL;
	}

	return ret;
}
+3 −3
Original line number Diff line number Diff line
/*
 * Copyright (c) 2015,2017 The Linux Foundation. All rights reserved.
 * Copyright (c) 2015,2017-2018 The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -898,7 +898,7 @@ static int dsi_cmd_dma_add(struct drm_gem_object *tx_gem,

	data = msm_gem_vaddr(tx_gem);

	if (IS_ERR(data)) {
	if (IS_ERR_OR_NULL(data)) {
		ret = PTR_ERR(data);
		pr_err("%s: get vaddr failed, %d\n", __func__, ret);
		return ret;
@@ -1006,7 +1006,7 @@ static int dsi_cmd_dma_rx(struct msm_dsi_host *msm_host,
	u32 *lp, *temp, data;
	int i, j = 0, cnt;
	u32 read_cnt;
	u8 reg[16];
	u8 reg[16] = {0};
	int repeated_bytes = 0;
	int buf_offset = buf - msm_host->rx_buf;

+13 −3
Original line number Diff line number Diff line
/*
 * Copyright (c) 2015,2017 The Linux Foundation. All rights reserved.
 * Copyright (c) 2015,2017-2018 The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -618,16 +618,26 @@ fail:
struct drm_connector *msm_dsi_manager_ext_bridge_init(u8 id)
{
	struct msm_dsi *msm_dsi = dsi_mgr_get_dsi(id);
	struct drm_device *dev = msm_dsi->dev;
	struct drm_device *dev;
	struct drm_encoder *encoder;
	struct drm_bridge *int_bridge, *ext_bridge;
	struct drm_connector *connector;
	struct list_head *connector_list;

	if (!msm_dsi)
		return ERR_PTR(-EINVAL);

	dev = msm_dsi->dev;

	int_bridge = msm_dsi->bridge;
	ext_bridge = msm_dsi->external_bridge =
			msm_dsi_host_get_bridge(msm_dsi->host);

	if (!int_bridge || !ext_bridge) {
		pr_err("%s: failed to get bridge info\n", __func__);
		return ERR_PTR(-EINVAL);
	}

	/*
	 * HACK: we may not know the external DSI bridge device's mode
	 * flags here. We'll get to know them only when the device
@@ -797,7 +807,7 @@ int msm_dsi_manager_register(struct msm_dsi *msm_dsi)
	int id = msm_dsi->id;
	int ret;

	if (id > DSI_MAX) {
	if (id >= DSI_MAX) {
		pr_err("%s: invalid id %d\n", __func__, id);
		return -EINVAL;
	}