drm/amd/amdgpu: amdgpu_hwmon_show_temp: initialize temp
authorErnst Sjöstrand <ernstp@gmail.com>
Mon, 24 Jun 2019 15:15:41 +0000 (17:15 +0200)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 25 Jun 2019 18:23:39 +0000 (13:23 -0500)
Reported by smatch:
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c:1496 amdgpu_hwmon_show_temp() error: uninitialized symbol 'temp'.

Signed-off-by: Ernst Sjöstrand <ernstp@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c

index 302307c..704c703 100644 (file)
@@ -1462,7 +1462,7 @@ static ssize_t amdgpu_hwmon_show_temp(struct device *dev,
        struct amdgpu_device *adev = dev_get_drvdata(dev);
        struct drm_device *ddev = adev->ddev;
        int channel = to_sensor_dev_attr(attr)->index;
-       int r, temp, size = sizeof(temp);
+       int r, temp = 0, size = sizeof(temp);
 
        /* Can't get temperature when the card is off */
        if  ((adev->flags & AMD_IS_PX) &&