drm/amd/powerplay: fix NULL point check error
authorRex Zhu <Rex.Zhu@amd.com>
Tue, 10 May 2016 05:39:29 +0000 (13:39 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 13 May 2016 18:26:11 +0000 (14:26 -0400)
&& was used instead of ||

Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.c

index 94b2a73f015116084f02c03470d9c1b173172dfd..4115dd8ec0515ed0e8d12754dcbf7299504248fb 100644 (file)
@@ -199,8 +199,9 @@ void phm_apply_dal_min_voltage_request(struct pp_hwmgr *hwmgr)
        enum PP_DAL_POWERLEVEL dal_power_level = hwmgr->dal_power_level;
        uint32_t req_vddc = 0, req_volt, i;
 
-       if (!table && !(dal_power_level >= PP_DAL_POWERLEVEL_ULTRALOW &&
-                       dal_power_level <= PP_DAL_POWERLEVEL_PERFORMANCE))
+       if (!table || table-count <= 0
+               || dal_power_level < PP_DAL_POWERLEVEL_ULTRALOW
+               || dal_power_level > PP_DAL_POWERLEVEL_PERFORMANCE)
                return;
 
        for (i = 0; i < table->count; i++) {