浏览代码

drm/amdgpu/dpm: don't add pwm attributes if DPM is disabled

PWM fan control is only available with DPM.  There is no non-DPM
support on amdgpu, so we should never get a crash here because
the sysfs nodes would never be created in the first place. Add the
check just in case to be on the safe side.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Alex Deucher 9 年之前
父节点
当前提交
27100735ad
共有 1 个文件被更改,包括 6 次插入2 次删除
  1. 6 2
      drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c

+ 6 - 2
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c

@@ -294,10 +294,14 @@ static umode_t hwmon_attributes_visible(struct kobject *kobj,
 	struct amdgpu_device *adev = dev_get_drvdata(dev);
 	struct amdgpu_device *adev = dev_get_drvdata(dev);
 	umode_t effective_mode = attr->mode;
 	umode_t effective_mode = attr->mode;
 
 
-	/* Skip limit attributes if DPM is not enabled */
+	/* Skip attributes if DPM is not enabled */
 	if (!adev->pm.dpm_enabled &&
 	if (!adev->pm.dpm_enabled &&
 	    (attr == &sensor_dev_attr_temp1_crit.dev_attr.attr ||
 	    (attr == &sensor_dev_attr_temp1_crit.dev_attr.attr ||
-	     attr == &sensor_dev_attr_temp1_crit_hyst.dev_attr.attr))
+	     attr == &sensor_dev_attr_temp1_crit_hyst.dev_attr.attr ||
+	     attr == &sensor_dev_attr_pwm1.dev_attr.attr ||
+	     attr == &sensor_dev_attr_pwm1_enable.dev_attr.attr ||
+	     attr == &sensor_dev_attr_pwm1_max.dev_attr.attr ||
+	     attr == &sensor_dev_attr_pwm1_min.dev_attr.attr))
 		return 0;
 		return 0;
 
 
 	/* Skip fan attributes if fan is not present */
 	/* Skip fan attributes if fan is not present */