Source-Changes-HG archive

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

[src/trunk]: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm Fix count vs...



details:   https://anonhg.NetBSD.org/src/rev/a9fd996afd99
branches:  trunk
changeset: 795519:a9fd996afd99
user:      skrll <skrll%NetBSD.org@localhost>
date:      Thu Apr 17 13:48:02 2014 +0000

description:
Fix count vs ret confusion. ret is only set on error when count == 0 -
make sure this is the case.

diffstat:

 sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c |  7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diffs (38 lines):

diff -r a40efd1c90f6 -r a9fd996afd99 sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c
--- a/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c       Thu Apr 17 12:35:24 2014 +0000
+++ b/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c       Thu Apr 17 13:48:02 2014 +0000
@@ -715,7 +715,6 @@
 
        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 @@
 
                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 @@
                                        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 @@
                        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);



Home | Main Index | Thread Index | Old Index