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

Commit da71f0ef authored by Dan Carpenter's avatar Dan Carpenter Committed by Ben Skeggs
Browse files

drm/nouveau/hwmon: potential uninitialized variables



Smatch complains that "value" can be uninitialized when kstrtol()
returns -ERANGE.

Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent 922a8c82
Loading
Loading
Loading
Loading
+6 −6
Original line number Original line Diff line number Diff line
@@ -69,8 +69,8 @@ nouveau_hwmon_set_temp1_auto_point1_temp(struct device *d,
	struct nvkm_therm *therm = nvxx_therm(&drm->client.device);
	struct nvkm_therm *therm = nvxx_therm(&drm->client.device);
	long value;
	long value;


	if (kstrtol(buf, 10, &value) == -EINVAL)
	if (kstrtol(buf, 10, &value))
		return count;
		return -EINVAL;


	therm->attr_set(therm, NVKM_THERM_ATTR_THRS_FAN_BOOST,
	therm->attr_set(therm, NVKM_THERM_ATTR_THRS_FAN_BOOST,
			value / 1000);
			value / 1000);
@@ -102,8 +102,8 @@ nouveau_hwmon_set_temp1_auto_point1_temp_hyst(struct device *d,
	struct nvkm_therm *therm = nvxx_therm(&drm->client.device);
	struct nvkm_therm *therm = nvxx_therm(&drm->client.device);
	long value;
	long value;


	if (kstrtol(buf, 10, &value) == -EINVAL)
	if (kstrtol(buf, 10, &value))
		return count;
		return -EINVAL;


	therm->attr_set(therm, NVKM_THERM_ATTR_THRS_FAN_BOOST_HYST,
	therm->attr_set(therm, NVKM_THERM_ATTR_THRS_FAN_BOOST_HYST,
			value / 1000);
			value / 1000);
@@ -156,7 +156,7 @@ nouveau_hwmon_set_pwm1_min(struct device *d, struct device_attribute *a,
	long value;
	long value;
	int ret;
	int ret;


	if (kstrtol(buf, 10, &value) == -EINVAL)
	if (kstrtol(buf, 10, &value))
		return -EINVAL;
		return -EINVAL;


	ret = therm->attr_set(therm, NVKM_THERM_ATTR_FAN_MIN_DUTY, value);
	ret = therm->attr_set(therm, NVKM_THERM_ATTR_FAN_MIN_DUTY, value);
@@ -179,7 +179,7 @@ nouveau_hwmon_set_pwm1_max(struct device *d, struct device_attribute *a,
	long value;
	long value;
	int ret;
	int ret;


	if (kstrtol(buf, 10, &value) == -EINVAL)
	if (kstrtol(buf, 10, &value))
		return -EINVAL;
		return -EINVAL;


	ret = therm->attr_set(therm, NVKM_THERM_ATTR_FAN_MAX_DUTY, value);
	ret = therm->attr_set(therm, NVKM_THERM_ATTR_FAN_MAX_DUTY, value);