Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit eb72ed5d authored by Karol Herbst's avatar Karol Herbst Committed by Ben Skeggs
Browse files

drm/nouveau/hwmon: don't require therm to be valid to get any data

parent 353b9834
Loading
Loading
Loading
Loading
+19 −20
Original line number Diff line number Diff line
@@ -640,9 +640,6 @@ nouveau_hwmon_init(struct drm_device *dev)
		return -ENOMEM;
	hwmon->dev = dev;

	if (!therm || !therm->attr_get || !therm->attr_set)
		return -ENODEV;

	hwmon_dev = hwmon_device_register(&dev->pdev->dev);
	if (IS_ERR(hwmon_dev)) {
		ret = PTR_ERR(hwmon_dev);
@@ -656,6 +653,7 @@ nouveau_hwmon_init(struct drm_device *dev)
	if (ret)
		goto error;

	if (therm && therm->attr_get && therm->attr_set) {
		/* if the card has a working thermal sensor */
		if (nvkm_therm_temp_get(therm) >= 0) {
			ret = sysfs_create_group(&hwmon_dev->kobj, &hwmon_temp_attrgroup);
@@ -673,9 +671,10 @@ nouveau_hwmon_init(struct drm_device *dev)
			if (ret)
				goto error;
		}
	}

	/* if the card can read the fan rpm */
	if (nvkm_therm_fan_sense(therm) >= 0) {
	if (therm && nvkm_therm_fan_sense(therm) >= 0) {
		ret = sysfs_create_group(&hwmon_dev->kobj,
					 &hwmon_fan_rpm_attrgroup);
		if (ret)