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

Commit d07ef2ef authored by Narendra Muppalla's avatar Narendra Muppalla
Browse files

disp: msm: fix kw issues in sde and dp driver



This change addresses out of range and null checks in
sde and dp driver.

Change-Id: I142196d7394f0bf0abab1bfa89abfd784a5521c8
Signed-off-by: default avatarNarendra Muppalla <NarendraM@codeaurora.org>
parent a60fc941
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -46,21 +46,21 @@ struct dp_hpd *dp_hpd_get(struct device *dev, struct dp_parser *parser,

	if (parser->no_aux_switch && parser->lphw_hpd) {
		dp_hpd = dp_lphw_hpd_get(dev, parser, catalog, cb);
		if (IS_ERR(dp_hpd)) {
		if (IS_ERR_OR_NULL(dp_hpd)) {
			DP_ERR("failed to get lphw hpd\n");
			return dp_hpd;
		}
		dp_hpd->type = DP_HPD_LPHW;
	} else if (parser->no_aux_switch) {
		dp_hpd = dp_gpio_hpd_get(dev, cb);
		if (IS_ERR(dp_hpd)) {
		if (IS_ERR_OR_NULL(dp_hpd)) {
			DP_ERR("failed to get gpio hpd\n");
			return dp_hpd;
		}
		dp_hpd->type = DP_HPD_GPIO;
	} else {
		dp_hpd = dp_altmode_get(dev, cb);
		if (!IS_ERR(dp_hpd)) {
		if (!IS_ERR_OR_NULL(dp_hpd)) {
			dp_hpd->type = DP_HPD_ALTMODE;
			goto config;
		}
@@ -68,7 +68,7 @@ struct dp_hpd *dp_hpd_get(struct device *dev, struct dp_parser *parser,
				PTR_ERR(dp_hpd));

		dp_hpd = dp_usbpd_get(dev, cb);
		if (IS_ERR(dp_hpd)) {
		if (IS_ERR_OR_NULL(dp_hpd)) {
			DP_ERR("failed to get usbpd\n");
			return dp_hpd;
		}
+14 −4
Original line number Diff line number Diff line
@@ -114,8 +114,14 @@ static struct page **get_pages(struct drm_gem_object *obj)
		 */
		if (msm_obj->flags & (MSM_BO_WC|MSM_BO_UNCACHED)) {
			aspace_dev = msm_gem_get_aspace_device(msm_obj->aspace);
			if (aspace_dev)
				dma_map_sg(aspace_dev, msm_obj->sgt->sgl,
				msm_obj->sgt->nents, DMA_BIDIRECTIONAL);
						msm_obj->sgt->nents,
						DMA_BIDIRECTIONAL);
			else
				dev_err(dev->dev,
					"failed to get aspace_device\n");

		}
	}

@@ -190,8 +196,12 @@ void msm_gem_sync(struct drm_gem_object *obj)
	 * scatter/gather mapping for the CPU and device.
	 */
	aspace_dev = msm_gem_get_aspace_device(msm_obj->aspace);
	if (aspace_dev)
		dma_sync_sg_for_device(aspace_dev, msm_obj->sgt->sgl,
				msm_obj->sgt->nents, DMA_BIDIRECTIONAL);
	else
		dev_err(obj->dev->dev,
			"failed to get aspace_device\n");
}


+4 −2
Original line number Diff line number Diff line
@@ -321,10 +321,10 @@ static void _sde_encoder_phys_cmd_setup_irq_hw_idx(
		struct sde_encoder_phys *phys_enc)
{
	struct sde_encoder_irq *irq;
	struct sde_kms *sde_kms = phys_enc->sde_kms;
	struct sde_kms *sde_kms;
	int ret = 0;

	if (!phys_enc || !phys_enc->hw_pp || !phys_enc->hw_ctl) {
	if (!phys_enc->sde_kms || !phys_enc->hw_pp || !phys_enc->hw_ctl) {
		SDE_ERROR("invalid args %d %d\n", !phys_enc,
			phys_enc ? !phys_enc->hw_pp : 0);
		return;
@@ -335,6 +335,8 @@ static void _sde_encoder_phys_cmd_setup_irq_hw_idx(
		return;
	}

	sde_kms = phys_enc->sde_kms;

	mutex_lock(&sde_kms->vblank_ctl_global_lock);

	if (atomic_read(&phys_enc->vblank_refcount)) {