[PATCH] drm/nouveau/device: ensure ret is initialized to zero

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Colin Ian King <colin.king@xxxxxxxxxxxxx>

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@xxxxxxxxxxxxx>
---
 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

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux