summaryrefslogtreecommitdiffstats
path: root/package/freescale-imx/imx-vpu/imx-vpu-0002-vpu-lib-fix-IOGetVirtMem-return-value-checks.patch
blob: 583a508c0eab0150d8868ca09ff6c5968749bdbd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
[PATCH] vpu-lib: fix IOGetVirtMem return value checks

When using a kernel where user/kernel split is 3G/1G, the address
returned by IOGetVirtMem() can appear to be a negative int.

IOSystemInit() incorrectly checks the return value of IOGetVirtMem().
IOGetVirtMem() returns -1 on error (and not MAP_FAILED, nor any other
negative value.)

Fix that by correctly checking against -1 (and not MAP_FAILED!)

Signed-off-by: Gary Bisson <bisson.gary@gmail.com>
[yann.morin.1998@free.fr: expand the commit log]
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
---
 vpu/vpu_lib.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/vpu/vpu_lib.c b/vpu/vpu_lib.c
index 1fb731b..7a7f42d 100644
--- a/vpu/vpu_lib.c
+++ b/vpu/vpu_lib.c
@@ -1764,7 +1764,7 @@ RetCode vpu_EncStartOneFrame(EncHandle handle, EncParam * param)
 				err_msg("Unable to obtain physical mem\n");
 				return RETCODE_FAILURE;
 			}
-			if (IOGetVirtMem(&pEncInfo->picParaBaseMem) <= 0) {
+			if (IOGetVirtMem(&pEncInfo->picParaBaseMem) == -1) {
 				IOFreePhyMem(&pEncInfo->picParaBaseMem);
 				pEncInfo->picParaBaseMem.phy_addr = 0;
 				err_msg("Unable to obtain virtual mem\n");
@@ -2982,7 +2982,7 @@ RetCode vpu_DecGetInitialInfo(DecHandle handle, DecInitialInfo * info)
 			UnlockVpu(vpu_semap);
 			return RETCODE_FAILURE;
 		}
-		if (IOGetVirtMem(&pDecInfo->userDataBufMem) <= 0) {
+		if (IOGetVirtMem(&pDecInfo->userDataBufMem) == -1) {
 			IOFreePhyMem(&pDecInfo->userDataBufMem);
 			pDecInfo->userDataBufMem.phy_addr = 0;
 			err_msg("Unable to obtain virtual mem\n");
@@ -4017,7 +4017,7 @@ RetCode vpu_DecStartOneFrame(DecHandle handle, DecParam * param)
 				UnlockVpu(vpu_semap);
 				return RETCODE_FAILURE;
 			}
-			if (IOGetVirtMem(&pDecInfo->picParaBaseMem) <= 0) {
+			if (IOGetVirtMem(&pDecInfo->picParaBaseMem) == -1) {
 				IOFreePhyMem(&pDecInfo->picParaBaseMem);
 				pDecInfo->picParaBaseMem.phy_addr = 0;
 				err_msg("Unable to obtain virtual mem\n");
@@ -4057,7 +4057,7 @@ RetCode vpu_DecStartOneFrame(DecHandle handle, DecParam * param)
 			UnlockVpu(vpu_semap);
 			return RETCODE_FAILURE;
 		}
-		if (IOGetVirtMem(&pDecInfo->userDataBufMem) <= 0) {
+		if (IOGetVirtMem(&pDecInfo->userDataBufMem) == -1) {
 			IOFreePhyMem(&pDecInfo->userDataBufMem);
 			pDecInfo->userDataBufMem.phy_addr = 0;
 			err_msg("Unable to obtain virtual mem\n");

OpenPOWER on IntegriCloud