From: Colin Ian King colin.king@canonical.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@canonical.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);
dri-devel@lists.freedesktop.org