mirror of https://gitee.com/openkylin/linux.git
drm/msm/dpu: Remove unnecessary NULL checks
drm_device.dev_private is set to a non-NULL msm_drm_private struct in msm_drm_init. Successful initialization of msm means that dev_private is non-NULL so there is no need to check it everywhere. Signed-off-by: Drew Davenport <ddavenport@chromium.org> Signed-off-by: Rob Clark <robdclark@chromium.org>
This commit is contained in:
parent
c3b80b28c1
commit
422ed75581
|
@ -349,9 +349,6 @@ void dpu_core_irq_preinstall(struct dpu_kms *dpu_kms)
|
|||
if (!dpu_kms->dev) {
|
||||
DPU_ERROR("invalid drm device\n");
|
||||
return;
|
||||
} else if (!dpu_kms->dev->dev_private) {
|
||||
DPU_ERROR("invalid device private\n");
|
||||
return;
|
||||
}
|
||||
priv = dpu_kms->dev->dev_private;
|
||||
|
||||
|
@ -385,9 +382,6 @@ void dpu_core_irq_uninstall(struct dpu_kms *dpu_kms)
|
|||
if (!dpu_kms->dev) {
|
||||
DPU_ERROR("invalid drm device\n");
|
||||
return;
|
||||
} else if (!dpu_kms->dev->dev_private) {
|
||||
DPU_ERROR("invalid device private\n");
|
||||
return;
|
||||
}
|
||||
priv = dpu_kms->dev->dev_private;
|
||||
|
||||
|
|
|
@ -33,13 +33,13 @@ static struct dpu_kms *_dpu_crtc_get_kms(struct drm_crtc *crtc)
|
|||
{
|
||||
struct msm_drm_private *priv;
|
||||
|
||||
if (!crtc->dev || !crtc->dev->dev_private) {
|
||||
if (!crtc->dev) {
|
||||
DPU_ERROR("invalid device\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
priv = crtc->dev->dev_private;
|
||||
if (!priv || !priv->kms) {
|
||||
if (!priv->kms) {
|
||||
DPU_ERROR("invalid kms\n");
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -694,7 +694,7 @@ static void dpu_crtc_disable(struct drm_crtc *crtc,
|
|||
unsigned long flags;
|
||||
bool release_bandwidth = false;
|
||||
|
||||
if (!crtc || !crtc->dev || !crtc->dev->dev_private || !crtc->state) {
|
||||
if (!crtc || !crtc->dev || !crtc->state) {
|
||||
DPU_ERROR("invalid crtc\n");
|
||||
return;
|
||||
}
|
||||
|
@ -766,7 +766,7 @@ static void dpu_crtc_enable(struct drm_crtc *crtc,
|
|||
struct msm_drm_private *priv;
|
||||
bool request_bandwidth;
|
||||
|
||||
if (!crtc || !crtc->dev || !crtc->dev->dev_private) {
|
||||
if (!crtc || !crtc->dev) {
|
||||
DPU_ERROR("invalid crtc\n");
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -735,8 +735,7 @@ static int dpu_encoder_resource_control(struct drm_encoder *drm_enc,
|
|||
struct msm_drm_private *priv;
|
||||
bool is_vid_mode = false;
|
||||
|
||||
if (!drm_enc || !drm_enc->dev || !drm_enc->dev->dev_private ||
|
||||
!drm_enc->crtc) {
|
||||
if (!drm_enc || !drm_enc->dev || !drm_enc->crtc) {
|
||||
DPU_ERROR("invalid parameters\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
@ -1092,7 +1091,7 @@ static void _dpu_encoder_virt_enable_helper(struct drm_encoder *drm_enc)
|
|||
struct msm_drm_private *priv;
|
||||
struct dpu_kms *dpu_kms;
|
||||
|
||||
if (!drm_enc || !drm_enc->dev || !drm_enc->dev->dev_private) {
|
||||
if (!drm_enc || !drm_enc->dev) {
|
||||
DPU_ERROR("invalid parameters\n");
|
||||
return;
|
||||
}
|
||||
|
@ -1193,9 +1192,6 @@ static void dpu_encoder_virt_disable(struct drm_encoder *drm_enc)
|
|||
} else if (!drm_enc->dev) {
|
||||
DPU_ERROR("invalid dev\n");
|
||||
return;
|
||||
} else if (!drm_enc->dev->dev_private) {
|
||||
DPU_ERROR("invalid dev_private\n");
|
||||
return;
|
||||
}
|
||||
|
||||
dpu_enc = to_dpu_encoder_virt(drm_enc);
|
||||
|
@ -1734,8 +1730,7 @@ static void dpu_encoder_vsync_event_handler(struct timer_list *t)
|
|||
struct msm_drm_private *priv;
|
||||
struct msm_drm_thread *event_thread;
|
||||
|
||||
if (!drm_enc->dev || !drm_enc->dev->dev_private ||
|
||||
!drm_enc->crtc) {
|
||||
if (!drm_enc->dev || !drm_enc->crtc) {
|
||||
DPU_ERROR("invalid parameters\n");
|
||||
return;
|
||||
}
|
||||
|
@ -1925,7 +1920,7 @@ static int _dpu_encoder_init_debugfs(struct drm_encoder *drm_enc)
|
|||
|
||||
char name[DPU_NAME_SIZE];
|
||||
|
||||
if (!drm_enc->dev || !drm_enc->dev->dev_private) {
|
||||
if (!drm_enc->dev) {
|
||||
DPU_ERROR("invalid encoder or kms\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
@ -2130,7 +2125,7 @@ static void dpu_encoder_frame_done_timeout(struct timer_list *t)
|
|||
struct drm_encoder *drm_enc = &dpu_enc->base;
|
||||
u32 event;
|
||||
|
||||
if (!drm_enc->dev || !drm_enc->dev->dev_private) {
|
||||
if (!drm_enc->dev) {
|
||||
DPU_ERROR("invalid parameters\n");
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -373,7 +373,7 @@ static void dpu_encoder_phys_cmd_tearcheck_config(
|
|||
}
|
||||
|
||||
dpu_kms = phys_enc->dpu_kms;
|
||||
if (!dpu_kms || !dpu_kms->dev || !dpu_kms->dev->dev_private) {
|
||||
if (!dpu_kms || !dpu_kms->dev) {
|
||||
DPU_ERROR("invalid device\n");
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -570,8 +570,7 @@ static void dpu_encoder_phys_vid_disable(struct dpu_encoder_phys *phys_enc)
|
|||
unsigned long lock_flags;
|
||||
int ret;
|
||||
|
||||
if (!phys_enc || !phys_enc->parent || !phys_enc->parent->dev ||
|
||||
!phys_enc->parent->dev->dev_private) {
|
||||
if (!phys_enc || !phys_enc->parent || !phys_enc->parent->dev) {
|
||||
DPU_ERROR("invalid encoder/device\n");
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -72,7 +72,7 @@ static int _dpu_danger_signal_status(struct seq_file *s,
|
|||
struct dpu_danger_safe_status status;
|
||||
int i;
|
||||
|
||||
if (!kms->dev || !kms->dev->dev_private || !kms->hw_mdp) {
|
||||
if (!kms->dev || !kms->hw_mdp) {
|
||||
DPU_ERROR("invalid arg(s)\n");
|
||||
return 0;
|
||||
}
|
||||
|
@ -157,9 +157,6 @@ static int _dpu_debugfs_show_regset32(struct seq_file *s, void *data)
|
|||
return 0;
|
||||
|
||||
priv = dev->dev_private;
|
||||
if (!priv)
|
||||
return 0;
|
||||
|
||||
base = dpu_kms->mmio + regset->offset;
|
||||
|
||||
/* insert padding spaces, if needed */
|
||||
|
@ -292,7 +289,7 @@ static void dpu_kms_prepare_commit(struct msm_kms *kms,
|
|||
dpu_kms = to_dpu_kms(kms);
|
||||
dev = dpu_kms->dev;
|
||||
|
||||
if (!dev || !dev->dev_private)
|
||||
if (!dev)
|
||||
return;
|
||||
priv = dev->dev_private;
|
||||
|
||||
|
@ -470,9 +467,6 @@ static void _dpu_kms_drm_obj_destroy(struct dpu_kms *dpu_kms)
|
|||
} else if (!dpu_kms->dev) {
|
||||
DPU_ERROR("invalid dev\n");
|
||||
return;
|
||||
} else if (!dpu_kms->dev->dev_private) {
|
||||
DPU_ERROR("invalid dev_private\n");
|
||||
return;
|
||||
}
|
||||
priv = dpu_kms->dev->dev_private;
|
||||
|
||||
|
@ -809,10 +803,6 @@ static int dpu_kms_hw_init(struct msm_kms *kms)
|
|||
}
|
||||
|
||||
priv = dev->dev_private;
|
||||
if (!priv) {
|
||||
DPU_ERROR("invalid private data\n");
|
||||
return rc;
|
||||
}
|
||||
|
||||
atomic_set(&dpu_kms->bandwidth_ref, 0);
|
||||
|
||||
|
@ -974,7 +964,7 @@ struct msm_kms *dpu_kms_init(struct drm_device *dev)
|
|||
struct dpu_kms *dpu_kms;
|
||||
int irq;
|
||||
|
||||
if (!dev || !dev->dev_private) {
|
||||
if (!dev) {
|
||||
DPU_ERROR("drm device node invalid\n");
|
||||
return ERR_PTR(-EINVAL);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue