Module Name: src Committed By: skrll Date: Thu Apr 17 13:48:02 UTC 2014
Modified Files: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm: vchiq_arm.c Log Message: Fix count vs ret confusion. ret is only set on error when count == 0 - make sure this is the case. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 \ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c diff -u src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c:1.11 src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c:1.12 --- src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c:1.11 Thu Mar 27 23:03:07 2014 +++ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c Thu Apr 17 13:48:02 2014 @@ -715,7 +715,6 @@ vchiq_ioctl(struct file *fp, u_long cmd, 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, 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, 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, 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);