1 [PATCH] vpu-lib: fix IOGetVirtMem return value checks
3 When using a kernel where user/kernel split is 3G/1G, the address
4 returned by IOGetVirtMem() can appear to be a negative int.
6 IOSystemInit() incorrectly checks the return value of IOGetVirtMem().
7 IOGetVirtMem() returns -1 on error (and not MAP_FAILED, nor any other
10 Fix that by correctly checking against -1 (and not MAP_FAILED!)
12 Signed-off-by: Gary Bisson <bisson.gary@gmail.com>
13 [yann.morin.1998@free.fr: expand the commit log]
14 Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
16 vpu/vpu_lib.c | 8 ++++----
17 1 file changed, 4 insertions(+), 4 deletions(-)
19 diff --git a/vpu/vpu_lib.c b/vpu/vpu_lib.c
20 index 1fb731b..7a7f42d 100644
23 @@ -1764,7 +1764,7 @@ RetCode vpu_EncStartOneFrame(EncHandle handle, EncParam * param)
24 err_msg("Unable to obtain physical mem\n");
25 return RETCODE_FAILURE;
27 - if (IOGetVirtMem(&pEncInfo->picParaBaseMem) <= 0) {
28 + if (IOGetVirtMem(&pEncInfo->picParaBaseMem) == -1) {
29 IOFreePhyMem(&pEncInfo->picParaBaseMem);
30 pEncInfo->picParaBaseMem.phy_addr = 0;
31 err_msg("Unable to obtain virtual mem\n");
32 @@ -2982,7 +2982,7 @@ RetCode vpu_DecGetInitialInfo(DecHandle handle, DecInitialInfo * info)
34 return RETCODE_FAILURE;
36 - if (IOGetVirtMem(&pDecInfo->userDataBufMem) <= 0) {
37 + if (IOGetVirtMem(&pDecInfo->userDataBufMem) == -1) {
38 IOFreePhyMem(&pDecInfo->userDataBufMem);
39 pDecInfo->userDataBufMem.phy_addr = 0;
40 err_msg("Unable to obtain virtual mem\n");
41 @@ -4017,7 +4017,7 @@ RetCode vpu_DecStartOneFrame(DecHandle handle, DecParam * param)
43 return RETCODE_FAILURE;
45 - if (IOGetVirtMem(&pDecInfo->picParaBaseMem) <= 0) {
46 + if (IOGetVirtMem(&pDecInfo->picParaBaseMem) == -1) {
47 IOFreePhyMem(&pDecInfo->picParaBaseMem);
48 pDecInfo->picParaBaseMem.phy_addr = 0;
49 err_msg("Unable to obtain virtual mem\n");
50 @@ -4057,7 +4057,7 @@ RetCode vpu_DecStartOneFrame(DecHandle handle, DecParam * param)
52 return RETCODE_FAILURE;
54 - if (IOGetVirtMem(&pDecInfo->userDataBufMem) <= 0) {
55 + if (IOGetVirtMem(&pDecInfo->userDataBufMem) == -1) {
56 IOFreePhyMem(&pDecInfo->userDataBufMem);
57 pDecInfo->userDataBufMem.phy_addr = 0;
58 err_msg("Unable to obtain virtual mem\n");