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: Narendra Muppalla <NarendraM@codeaurora.org>
This commit is contained in:
@@ -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) {
|
if (parser->no_aux_switch && parser->lphw_hpd) {
|
||||||
dp_hpd = dp_lphw_hpd_get(dev, parser, catalog, cb);
|
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");
|
DP_ERR("failed to get lphw hpd\n");
|
||||||
return dp_hpd;
|
return dp_hpd;
|
||||||
}
|
}
|
||||||
dp_hpd->type = DP_HPD_LPHW;
|
dp_hpd->type = DP_HPD_LPHW;
|
||||||
} else if (parser->no_aux_switch) {
|
} else if (parser->no_aux_switch) {
|
||||||
dp_hpd = dp_gpio_hpd_get(dev, cb);
|
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");
|
DP_ERR("failed to get gpio hpd\n");
|
||||||
return dp_hpd;
|
return dp_hpd;
|
||||||
}
|
}
|
||||||
dp_hpd->type = DP_HPD_GPIO;
|
dp_hpd->type = DP_HPD_GPIO;
|
||||||
} else {
|
} else {
|
||||||
dp_hpd = dp_altmode_get(dev, cb);
|
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;
|
dp_hpd->type = DP_HPD_ALTMODE;
|
||||||
goto config;
|
goto config;
|
||||||
}
|
}
|
||||||
@@ -68,7 +68,7 @@ struct dp_hpd *dp_hpd_get(struct device *dev, struct dp_parser *parser,
|
|||||||
PTR_ERR(dp_hpd));
|
PTR_ERR(dp_hpd));
|
||||||
|
|
||||||
dp_hpd = dp_usbpd_get(dev, cb);
|
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");
|
DP_ERR("failed to get usbpd\n");
|
||||||
return dp_hpd;
|
return dp_hpd;
|
||||||
}
|
}
|
||||||
|
@@ -114,8 +114,14 @@ static struct page **get_pages(struct drm_gem_object *obj)
|
|||||||
*/
|
*/
|
||||||
if (msm_obj->flags & (MSM_BO_WC|MSM_BO_UNCACHED)) {
|
if (msm_obj->flags & (MSM_BO_WC|MSM_BO_UNCACHED)) {
|
||||||
aspace_dev = msm_gem_get_aspace_device(msm_obj->aspace);
|
aspace_dev = msm_gem_get_aspace_device(msm_obj->aspace);
|
||||||
dma_map_sg(aspace_dev, msm_obj->sgt->sgl,
|
if (aspace_dev)
|
||||||
msm_obj->sgt->nents, DMA_BIDIRECTIONAL);
|
dma_map_sg(aspace_dev, msm_obj->sgt->sgl,
|
||||||
|
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.
|
* scatter/gather mapping for the CPU and device.
|
||||||
*/
|
*/
|
||||||
aspace_dev = msm_gem_get_aspace_device(msm_obj->aspace);
|
aspace_dev = msm_gem_get_aspace_device(msm_obj->aspace);
|
||||||
dma_sync_sg_for_device(aspace_dev, msm_obj->sgt->sgl,
|
if (aspace_dev)
|
||||||
msm_obj->sgt->nents, DMA_BIDIRECTIONAL);
|
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");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -321,10 +321,10 @@ static void _sde_encoder_phys_cmd_setup_irq_hw_idx(
|
|||||||
struct sde_encoder_phys *phys_enc)
|
struct sde_encoder_phys *phys_enc)
|
||||||
{
|
{
|
||||||
struct sde_encoder_irq *irq;
|
struct sde_encoder_irq *irq;
|
||||||
struct sde_kms *sde_kms = phys_enc->sde_kms;
|
struct sde_kms *sde_kms;
|
||||||
int ret = 0;
|
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,
|
SDE_ERROR("invalid args %d %d\n", !phys_enc,
|
||||||
phys_enc ? !phys_enc->hw_pp : 0);
|
phys_enc ? !phys_enc->hw_pp : 0);
|
||||||
return;
|
return;
|
||||||
@@ -335,6 +335,8 @@ static void _sde_encoder_phys_cmd_setup_irq_hw_idx(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sde_kms = phys_enc->sde_kms;
|
||||||
|
|
||||||
mutex_lock(&sde_kms->vblank_ctl_global_lock);
|
mutex_lock(&sde_kms->vblank_ctl_global_lock);
|
||||||
|
|
||||||
if (atomic_read(&phys_enc->vblank_refcount)) {
|
if (atomic_read(&phys_enc->vblank_refcount)) {
|
||||||
|
Reference in New Issue
Block a user