]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
drm/nouveau/hwmon: potential uninitialized variables
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 11 Jul 2018 08:02:28 +0000 (11:02 +0300)
committerBen Skeggs <bskeggs@redhat.com>
Mon, 16 Jul 2018 08:06:29 +0000 (18:06 +1000)
Smatch complains that "value" can be uninitialized when kstrtol()
returns -ERANGE.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/nouveau_hwmon.c

index 44178b4c359980d171332c19226d044de1817534..08a1ab6b150d00162300e9921d65adfa1ce05647 100644 (file)
@@ -69,8 +69,8 @@ nouveau_hwmon_set_temp1_auto_point1_temp(struct device *d,
        struct nvkm_therm *therm = nvxx_therm(&drm->client.device);
        long value;
 
-       if (kstrtol(buf, 10, &value) == -EINVAL)
-               return count;
+       if (kstrtol(buf, 10, &value))
+               return -EINVAL;
 
        therm->attr_set(therm, NVKM_THERM_ATTR_THRS_FAN_BOOST,
                        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);
        long value;
 
-       if (kstrtol(buf, 10, &value) == -EINVAL)
-               return count;
+       if (kstrtol(buf, 10, &value))
+               return -EINVAL;
 
        therm->attr_set(therm, NVKM_THERM_ATTR_THRS_FAN_BOOST_HYST,
                        value / 1000);
@@ -156,7 +156,7 @@ nouveau_hwmon_set_pwm1_min(struct device *d, struct device_attribute *a,
        long value;
        int ret;
 
-       if (kstrtol(buf, 10, &value) == -EINVAL)
+       if (kstrtol(buf, 10, &value))
                return -EINVAL;
 
        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;
        int ret;
 
-       if (kstrtol(buf, 10, &value) == -EINVAL)
+       if (kstrtol(buf, 10, &value))
                return -EINVAL;
 
        ret = therm->attr_set(therm, NVKM_THERM_ATTR_FAN_MAX_DUTY, value);