]> Zhao Yanbai Git Server - minix.git/commitdiff
libaudiodriver: resolve Coverity warnings
authorDavid van Moolenbroek <david@minix3.org>
Fri, 17 Aug 2012 16:02:42 +0000 (16:02 +0000)
committerDavid van Moolenbroek <david@minix3.org>
Fri, 24 Aug 2012 09:17:25 +0000 (09:17 +0000)
lib/libaudiodriver/audio_fw.c

index d576f356d280afee5f2c4c8dd45a9804cbae3e10..dba5247d80e62e9aea5ad829c4a8b81e392c26b8 100644 (file)
@@ -790,11 +790,13 @@ static void data_from_user(sub_dev_t *subdev)
 
        if (subdev->DmaLength < subdev->NrOfDmaFragments) { /* room in dma buf */
 
-               sys_safecopyfrom(subdev->SourceProcNr, 
+               r = sys_safecopyfrom(subdev->SourceProcNr,
                                (vir_bytes)subdev->ReviveGrant, 0, 
                                (vir_bytes)subdev->DmaPtr + 
                                subdev->DmaFillNext * subdev->FragSize,
                                (phys_bytes)subdev->FragSize);
+               if (r != OK)
+                       printf("%s:%d: safecopy failed\n", __FILE__, __LINE__);
 
 
                subdev->DmaLength += 1;
@@ -803,11 +805,13 @@ static void data_from_user(sub_dev_t *subdev)
 
        } else { /* room in extra buf */ 
 
-               sys_safecopyfrom(subdev->SourceProcNr, 
+               r = sys_safecopyfrom(subdev->SourceProcNr,
                                (vir_bytes)subdev->ReviveGrant, 0,
                                (vir_bytes)subdev->ExtraBuf + 
                                subdev->BufFillNext * subdev->FragSize, 
                                (phys_bytes)subdev->FragSize);
+               if (r != OK)
+                       printf("%s:%d: safecopy failed\n", __FILE__, __LINE__);
 
                subdev->BufLength += 1;
 
@@ -857,11 +861,13 @@ static void data_to_user(sub_dev_t *sub_dev_ptr)
 
        if(sub_dev_ptr->BufLength != 0) { /* data in extra buffer available */
 
-               sys_safecopyto(sub_dev_ptr->SourceProcNr, 
+               r = sys_safecopyto(sub_dev_ptr->SourceProcNr,
                                (vir_bytes)sub_dev_ptr->ReviveGrant,
                                0, (vir_bytes)sub_dev_ptr->ExtraBuf + 
                                sub_dev_ptr->BufReadNext * sub_dev_ptr->FragSize,
                                (phys_bytes)sub_dev_ptr->FragSize);
+               if (r != OK)
+                       printf("%s:%d: safecopy failed\n", __FILE__, __LINE__);
 
                /* adjust the buffer status variables */
                sub_dev_ptr->BufReadNext = 
@@ -869,12 +875,14 @@ static void data_to_user(sub_dev_t *sub_dev_ptr)
                sub_dev_ptr->BufLength -= 1;
 
        } else { /* extra buf empty, but data in dma buf*/ 
-               sys_safecopyto(
+               r = sys_safecopyto(
                                sub_dev_ptr->SourceProcNr, 
                                (vir_bytes)sub_dev_ptr->ReviveGrant, 0, 
                                (vir_bytes)sub_dev_ptr->DmaPtr + 
                                sub_dev_ptr->DmaReadNext * sub_dev_ptr->FragSize,
                                (phys_bytes)sub_dev_ptr->FragSize);
+               if (r != OK)
+                       printf("%s:%d: safecopy failed\n", __FILE__, __LINE__);
 
                /* adjust the buffer status variables */
                sub_dev_ptr->DmaReadNext = 
@@ -933,9 +941,7 @@ static int init_buffers(sub_dev_t *sub_dev_ptr)
        }
 
        sub_dev_ptr->DmaPtr = sub_dev_ptr->DmaBuf;
-       i = sys_umap(SELF, VM_D, 
-                       (vir_bytes) sub_dev_ptr->DmaBuf, 
-                       (phys_bytes) sizeof(sub_dev_ptr->DmaBuf), 
+       i = sys_umap(SELF, VM_D, (vir_bytes) base, (phys_bytes) size,
                        &(sub_dev_ptr->DmaPhys));
 
        if (i != OK) {