[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1452684474-17285-1-git-send-email-colin.king@canonical.com>
Date: Wed, 13 Jan 2016 11:27:54 +0000
From: Colin King <colin.king@...onical.com>
To: David Airlie <airlied@...ux.ie>, Ben Skeggs <bskeggs@...hat.com>,
dri-devel@...ts.freedesktop.org
Subject: [PATCH] drm/nouveau/device: ensure ret is initialized to zero
From: Colin Ian King <colin.king@...onical.com>
nvkm_udevice_time does not initialize ret and this is used
in the macro nvif_unpack(). Intializing it to zero allows the
compiler to optimize out the ret == -ENOSYS check in the macro.
Issue found by static analysis with cppcheck:
[drivers/gpu/drm/nouveau/nvkm/engine/device/user.c:136]:
(error) Uninitialized variable: ret
Signed-off-by: Colin Ian King <colin.king@...onical.com>
---
drivers/gpu/drm/nouveau/nvkm/engine/device/user.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/device/user.c b/drivers/gpu/drm/nouveau/nvkm/engine/device/user.c
index 1ae48f2..93e0e53 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/device/user.c
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/device/user.c
@@ -127,7 +127,7 @@ nvkm_udevice_time(struct nvkm_udevice *udev, void *data, u32 size)
union {
struct nv_device_time_v0 v0;
} *args = data;
- int ret;
+ int ret = 0;
if (nvif_unpack(args->v0, 0, 0, false)) {
args->v0.time = nvkm_timer_read(device->timer);
--
2.7.0.rc3
Powered by blists - more mailing lists