Commit 422ed755 authored by Drew Davenport's avatar Drew Davenport Committed by Rob Clark

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: default avatarDrew Davenport <ddavenport@chromium.org>
Signed-off-by: default avatarRob Clark <robdclark@chromium.org>
parent c3b80b28
...@@ -349,9 +349,6 @@ void dpu_core_irq_preinstall(struct dpu_kms *dpu_kms) ...@@ -349,9 +349,6 @@ void dpu_core_irq_preinstall(struct dpu_kms *dpu_kms)
if (!dpu_kms->dev) { if (!dpu_kms->dev) {
DPU_ERROR("invalid drm device\n"); DPU_ERROR("invalid drm device\n");
return; return;
} else if (!dpu_kms->dev->dev_private) {
DPU_ERROR("invalid device private\n");
return;
} }
priv = dpu_kms->dev->dev_private; priv = dpu_kms->dev->dev_private;
...@@ -385,9 +382,6 @@ void dpu_core_irq_uninstall(struct dpu_kms *dpu_kms) ...@@ -385,9 +382,6 @@ void dpu_core_irq_uninstall(struct dpu_kms *dpu_kms)
if (!dpu_kms->dev) { if (!dpu_kms->dev) {
DPU_ERROR("invalid drm device\n"); DPU_ERROR("invalid drm device\n");
return; return;
} else if (!dpu_kms->dev->dev_private) {
DPU_ERROR("invalid device private\n");
return;
} }
priv = dpu_kms->dev->dev_private; priv = dpu_kms->dev->dev_private;
......
...@@ -33,13 +33,13 @@ static struct dpu_kms *_dpu_crtc_get_kms(struct drm_crtc *crtc) ...@@ -33,13 +33,13 @@ static struct dpu_kms *_dpu_crtc_get_kms(struct drm_crtc *crtc)
{ {
struct msm_drm_private *priv; struct msm_drm_private *priv;
if (!crtc->dev || !crtc->dev->dev_private) { if (!crtc->dev) {
DPU_ERROR("invalid device\n"); DPU_ERROR("invalid device\n");
return NULL; return NULL;
} }
priv = crtc->dev->dev_private; priv = crtc->dev->dev_private;
if (!priv || !priv->kms) { if (!priv->kms) {
DPU_ERROR("invalid kms\n"); DPU_ERROR("invalid kms\n");
return NULL; return NULL;
} }
......
...@@ -694,7 +694,7 @@ static void dpu_crtc_disable(struct drm_crtc *crtc, ...@@ -694,7 +694,7 @@ static void dpu_crtc_disable(struct drm_crtc *crtc,
unsigned long flags; unsigned long flags;
bool release_bandwidth = false; 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"); DPU_ERROR("invalid crtc\n");
return; return;
} }
...@@ -766,7 +766,7 @@ static void dpu_crtc_enable(struct drm_crtc *crtc, ...@@ -766,7 +766,7 @@ static void dpu_crtc_enable(struct drm_crtc *crtc,
struct msm_drm_private *priv; struct msm_drm_private *priv;
bool request_bandwidth; bool request_bandwidth;
if (!crtc || !crtc->dev || !crtc->dev->dev_private) { if (!crtc || !crtc->dev) {
DPU_ERROR("invalid crtc\n"); DPU_ERROR("invalid crtc\n");
return; return;
} }
......
...@@ -735,8 +735,7 @@ static int dpu_encoder_resource_control(struct drm_encoder *drm_enc, ...@@ -735,8 +735,7 @@ static int dpu_encoder_resource_control(struct drm_encoder *drm_enc,
struct msm_drm_private *priv; struct msm_drm_private *priv;
bool is_vid_mode = false; bool is_vid_mode = false;
if (!drm_enc || !drm_enc->dev || !drm_enc->dev->dev_private || if (!drm_enc || !drm_enc->dev || !drm_enc->crtc) {
!drm_enc->crtc) {
DPU_ERROR("invalid parameters\n"); DPU_ERROR("invalid parameters\n");
return -EINVAL; return -EINVAL;
} }
...@@ -1092,7 +1091,7 @@ static void _dpu_encoder_virt_enable_helper(struct drm_encoder *drm_enc) ...@@ -1092,7 +1091,7 @@ static void _dpu_encoder_virt_enable_helper(struct drm_encoder *drm_enc)
struct msm_drm_private *priv; struct msm_drm_private *priv;
struct dpu_kms *dpu_kms; 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"); DPU_ERROR("invalid parameters\n");
return; return;
} }
...@@ -1193,9 +1192,6 @@ static void dpu_encoder_virt_disable(struct drm_encoder *drm_enc) ...@@ -1193,9 +1192,6 @@ static void dpu_encoder_virt_disable(struct drm_encoder *drm_enc)
} else if (!drm_enc->dev) { } else if (!drm_enc->dev) {
DPU_ERROR("invalid dev\n"); DPU_ERROR("invalid dev\n");
return; return;
} else if (!drm_enc->dev->dev_private) {
DPU_ERROR("invalid dev_private\n");
return;
} }
dpu_enc = to_dpu_encoder_virt(drm_enc); dpu_enc = to_dpu_encoder_virt(drm_enc);
...@@ -1734,8 +1730,7 @@ static void dpu_encoder_vsync_event_handler(struct timer_list *t) ...@@ -1734,8 +1730,7 @@ static void dpu_encoder_vsync_event_handler(struct timer_list *t)
struct msm_drm_private *priv; struct msm_drm_private *priv;
struct msm_drm_thread *event_thread; struct msm_drm_thread *event_thread;
if (!drm_enc->dev || !drm_enc->dev->dev_private || if (!drm_enc->dev || !drm_enc->crtc) {
!drm_enc->crtc) {
DPU_ERROR("invalid parameters\n"); DPU_ERROR("invalid parameters\n");
return; return;
} }
...@@ -1925,7 +1920,7 @@ static int _dpu_encoder_init_debugfs(struct drm_encoder *drm_enc) ...@@ -1925,7 +1920,7 @@ static int _dpu_encoder_init_debugfs(struct drm_encoder *drm_enc)
char name[DPU_NAME_SIZE]; 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"); DPU_ERROR("invalid encoder or kms\n");
return -EINVAL; return -EINVAL;
} }
...@@ -2130,7 +2125,7 @@ static void dpu_encoder_frame_done_timeout(struct timer_list *t) ...@@ -2130,7 +2125,7 @@ static void dpu_encoder_frame_done_timeout(struct timer_list *t)
struct drm_encoder *drm_enc = &dpu_enc->base; struct drm_encoder *drm_enc = &dpu_enc->base;
u32 event; u32 event;
if (!drm_enc->dev || !drm_enc->dev->dev_private) { if (!drm_enc->dev) {
DPU_ERROR("invalid parameters\n"); DPU_ERROR("invalid parameters\n");
return; return;
} }
......
...@@ -373,7 +373,7 @@ static void dpu_encoder_phys_cmd_tearcheck_config( ...@@ -373,7 +373,7 @@ static void dpu_encoder_phys_cmd_tearcheck_config(
} }
dpu_kms = phys_enc->dpu_kms; 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"); DPU_ERROR("invalid device\n");
return; return;
} }
......
...@@ -570,8 +570,7 @@ static void dpu_encoder_phys_vid_disable(struct dpu_encoder_phys *phys_enc) ...@@ -570,8 +570,7 @@ static void dpu_encoder_phys_vid_disable(struct dpu_encoder_phys *phys_enc)
unsigned long lock_flags; unsigned long lock_flags;
int ret; int ret;
if (!phys_enc || !phys_enc->parent || !phys_enc->parent->dev || if (!phys_enc || !phys_enc->parent || !phys_enc->parent->dev) {
!phys_enc->parent->dev->dev_private) {
DPU_ERROR("invalid encoder/device\n"); DPU_ERROR("invalid encoder/device\n");
return; return;
} }
......
...@@ -72,7 +72,7 @@ static int _dpu_danger_signal_status(struct seq_file *s, ...@@ -72,7 +72,7 @@ static int _dpu_danger_signal_status(struct seq_file *s,
struct dpu_danger_safe_status status; struct dpu_danger_safe_status status;
int i; int i;
if (!kms->dev || !kms->dev->dev_private || !kms->hw_mdp) { if (!kms->dev || !kms->hw_mdp) {
DPU_ERROR("invalid arg(s)\n"); DPU_ERROR("invalid arg(s)\n");
return 0; return 0;
} }
...@@ -157,9 +157,6 @@ static int _dpu_debugfs_show_regset32(struct seq_file *s, void *data) ...@@ -157,9 +157,6 @@ static int _dpu_debugfs_show_regset32(struct seq_file *s, void *data)
return 0; return 0;
priv = dev->dev_private; priv = dev->dev_private;
if (!priv)
return 0;
base = dpu_kms->mmio + regset->offset; base = dpu_kms->mmio + regset->offset;
/* insert padding spaces, if needed */ /* insert padding spaces, if needed */
...@@ -292,7 +289,7 @@ static void dpu_kms_prepare_commit(struct msm_kms *kms, ...@@ -292,7 +289,7 @@ static void dpu_kms_prepare_commit(struct msm_kms *kms,
dpu_kms = to_dpu_kms(kms); dpu_kms = to_dpu_kms(kms);
dev = dpu_kms->dev; dev = dpu_kms->dev;
if (!dev || !dev->dev_private) if (!dev)
return; return;
priv = dev->dev_private; priv = dev->dev_private;
...@@ -470,9 +467,6 @@ static void _dpu_kms_drm_obj_destroy(struct dpu_kms *dpu_kms) ...@@ -470,9 +467,6 @@ static void _dpu_kms_drm_obj_destroy(struct dpu_kms *dpu_kms)
} else if (!dpu_kms->dev) { } else if (!dpu_kms->dev) {
DPU_ERROR("invalid dev\n"); DPU_ERROR("invalid dev\n");
return; return;
} else if (!dpu_kms->dev->dev_private) {
DPU_ERROR("invalid dev_private\n");
return;
} }
priv = dpu_kms->dev->dev_private; priv = dpu_kms->dev->dev_private;
...@@ -809,10 +803,6 @@ static int dpu_kms_hw_init(struct msm_kms *kms) ...@@ -809,10 +803,6 @@ static int dpu_kms_hw_init(struct msm_kms *kms)
} }
priv = dev->dev_private; priv = dev->dev_private;
if (!priv) {
DPU_ERROR("invalid private data\n");
return rc;
}
atomic_set(&dpu_kms->bandwidth_ref, 0); atomic_set(&dpu_kms->bandwidth_ref, 0);
...@@ -974,7 +964,7 @@ struct msm_kms *dpu_kms_init(struct drm_device *dev) ...@@ -974,7 +964,7 @@ struct msm_kms *dpu_kms_init(struct drm_device *dev)
struct dpu_kms *dpu_kms; struct dpu_kms *dpu_kms;
int irq; int irq;
if (!dev || !dev->dev_private) { if (!dev) {
DPU_ERROR("drm device node invalid\n"); DPU_ERROR("drm device node invalid\n");
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment