Fix count vs ret confusion. ret is only set on error when count == 0 -
make sure this is the case.
This commit is contained in:
parent
5546b37c59
commit
e726eb3c65
|
@ -715,7 +715,6 @@ vchiq_ioctl(struct file *fp, u_long cmd, void *arg)
|
|||
|
||||
case VCHIQ_IOC_AWAIT_COMPLETION: {
|
||||
VCHIQ_AWAIT_COMPLETION_T *pargs = arg;
|
||||
int count = 0;
|
||||
|
||||
DEBUG_TRACE(AWAIT_COMPLETION_LINE);
|
||||
if (!instance->connected) {
|
||||
|
@ -750,6 +749,8 @@ vchiq_ioctl(struct file *fp, u_long cmd, void *arg)
|
|||
|
||||
if (ret == 0) {
|
||||
int msgbufcount = pargs->msgbufcount;
|
||||
int count;
|
||||
|
||||
for (count = 0; count < pargs->count; count++) {
|
||||
VCHIQ_COMPLETION_DATA_T *completion;
|
||||
VCHIQ_SERVICE_T *service1;
|
||||
|
@ -831,7 +832,7 @@ vchiq_ioctl(struct file *fp, u_long cmd, void *arg)
|
|||
count * sizeof(VCHIQ_COMPLETION_DATA_T)),
|
||||
completion,
|
||||
sizeof(VCHIQ_COMPLETION_DATA_T)) != 0) {
|
||||
if (ret == 0)
|
||||
if (count == 0)
|
||||
ret = -EFAULT;
|
||||
break;
|
||||
}
|
||||
|
@ -843,7 +844,7 @@ vchiq_ioctl(struct file *fp, u_long cmd, void *arg)
|
|||
pargs->count = count;
|
||||
}
|
||||
|
||||
if ((ret == 0 && count > 0) || ret != 0)
|
||||
if (ret != 0)
|
||||
up(&instance->remove_event);
|
||||
lmutex_unlock(&instance->completion_mutex);
|
||||
DEBUG_TRACE(AWAIT_COMPLETION_LINE);
|
||||
|
|
Loading…
Reference in New Issue