From 2ce463ad8fed027df0ad358e46d22c0d3b59c25a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Lothar=20Wa=C3=9Fmann?= Date: Thu, 26 Feb 2015 11:01:00 +0100 Subject: [PATCH] mxc: vpu: explicitly set return value in each code path of vpu_ioctl() Do not initialize the 'ret' variable, but explicitly set in in each code path, so that an forgotten assignment in some code path would lead to an 'uninitialized variable' warning at compile time. --- drivers/mxc/vpu/mxc_vpu.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/mxc/vpu/mxc_vpu.c b/drivers/mxc/vpu/mxc_vpu.c index 44048d108e93..86cdf4caf956 100644 --- a/drivers/mxc/vpu/mxc_vpu.c +++ b/drivers/mxc/vpu/mxc_vpu.c @@ -324,7 +324,7 @@ static int vpu_open(struct inode *inode, struct file *filp) static long vpu_ioctl(struct file *filp, u_int cmd, u_long arg) { - int ret = -EINVAL; + int ret; struct vpu_user_data *user_data = filp->private_data; struct vpu_priv *vpu_data = user_data->vpu_data; @@ -389,6 +389,7 @@ static long vpu_ioctl(struct file *filp, u_int cmd, kfree(rec); mutex_unlock(&vpu_data->lock); + ret = 0; break; } case VPU_IOC_WAIT4INT: @@ -405,7 +406,7 @@ static long vpu_ioctl(struct file *filp, u_int cmd, dev_warn(vpu_dev, "VPU interrupt received.\n"); ret = -ERESTARTSYS; } else { - irq_status = 0; + ret = irq_status = 0; } break; } @@ -530,7 +531,7 @@ static long vpu_ioctl(struct file *filp, u_int cmd, break; case VPU_IOC_REG_DUMP: case VPU_IOC_PHYMEM_DUMP: - ret = 0; + ret = -ENOTSUPP; break; case VPU_IOC_PHYMEM_CHECK: { @@ -564,6 +565,7 @@ static long vpu_ioctl(struct file *filp, u_int cmd, } default: dev_err(vpu_dev, "No such IOCTL, cmd is %d\n", cmd); + ret = -EINVAL; } return ret; } -- 2.39.5