drm/amd/display: Remove redundant null checks
authorAlex Hung <alex.hung@amd.com>
Fri, 7 Jun 2024 01:49:23 +0000 (19:49 -0600)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 19 Jun 2024 16:46:21 +0000 (12:46 -0400)
The null checks for aconnector and aconnector->dc_link and
stream redundant as they were already dereferenced previously
as reported by Coverity; therefore the null checks are removed.

This fixes 4 REVERSE_INULL issues reported by Coverity.

Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Acked-by: Hamza Mahfooz <hamza.mahfooz@amd.com>
Signed-off-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c

index efde7157dc06c39d08940228227bd790898e3935..60404385d4d0e6eea49612682c903d0c5156e8da 100644 (file)
@@ -3180,7 +3180,7 @@ static int dm_resume(void *handle)
                 * this is the case when traversing through already created end sink
                 * MST connectors, should be skipped
                 */
-               if (aconnector && aconnector->mst_root)
+               if (aconnector->mst_root)
                        continue;
 
                mutex_lock(&aconnector->hpd_lock);
@@ -6422,13 +6422,13 @@ static void apply_dsc_policy_for_stream(struct amdgpu_dm_connector *aconnector,
        dc_dsc_policy_set_enable_dsc_when_not_needed(
                aconnector->dsc_settings.dsc_force_enable == DSC_CLK_FORCE_ENABLE);
 
-       if (aconnector->dc_link && sink->sink_signal == SIGNAL_TYPE_EDP &&
+       if (sink->sink_signal == SIGNAL_TYPE_EDP &&
            !aconnector->dc_link->panel_config.dsc.disable_dsc_edp &&
            dc->caps.edp_dsc_support && aconnector->dsc_settings.dsc_force_enable != DSC_CLK_FORCE_DISABLE) {
 
                apply_dsc_policy_for_edp(aconnector, sink, stream, dsc_caps, max_dsc_target_bpp_limit_override);
 
-       } else if (aconnector->dc_link && sink->sink_signal == SIGNAL_TYPE_DISPLAY_PORT) {
+       } else if (sink->sink_signal == SIGNAL_TYPE_DISPLAY_PORT) {
                if (sink->link->dpcd_caps.dongle_type == DISPLAY_DONGLE_NONE) {
                        if (dc_dsc_compute_config(aconnector->dc_link->ctx->dc->res_pool->dscs[0],
                                                dsc_caps,
index 7cfa240a3cea7b10a5a58b4a80f438dfc74f3300..717d97191ddad8b85960858bcd8a1258f6be5a36 100644 (file)
@@ -1420,7 +1420,7 @@ static ssize_t trigger_hotplug(struct file *f, const char __user *buf,
        uint8_t param_nums = 0;
        bool ret = false;
 
-       if (!aconnector || !aconnector->dc_link)
+       if (!aconnector->dc_link)
                return -EINVAL;
 
        if (size == 0)
index 8eb2f10f2c38bff121d2c20dd3da0e81dd737a4e..659dd67be1baa126b094fdd368daa390222938cc 100644 (file)
@@ -807,9 +807,6 @@ bool dm_helpers_dp_write_dsc_enable(
        uint8_t enable_passthrough = enable ? DSC_PASSTHROUGH : DSC_DISABLE;
        uint8_t ret = 0;
 
-       if (!stream)
-               return false;
-
        if (stream->signal == SIGNAL_TYPE_DISPLAY_PORT_MST) {
                if (!aconnector->dsc_aux)
                        return false;