aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc
diff options
context:
space:
mode:
authorAlexei Shlychkov <shlychkov@gmail.com>2012-04-26 16:58:07 -0700
committerZiyann <jaraidaniel@gmail.com>2014-10-01 12:58:22 +0200
commita9a0fe0a97c04543befbb67bdcfd75839294be11 (patch)
tree84bc7a64200bc643107914ab02c90f3d5d7590b8 /drivers/misc
parent9ead2c5c1a92dfd275fda1e9afb5419fb995d1a0 (diff)
downloadkernel_samsung_tuna-a9a0fe0a97c04543befbb67bdcfd75839294be11.zip
kernel_samsung_tuna-a9a0fe0a97c04543befbb67bdcfd75839294be11.tar.gz
kernel_samsung_tuna-a9a0fe0a97c04543befbb67bdcfd75839294be11.tar.bz2
gcx: fixed error handling.
Change-Id: I4e38c35b51fbff71f2f9070e67478ebb726c3c4a Signed-off-by: Alexei Shlychkov <shlychkov@gmail.com>
Diffstat (limited to 'drivers/misc')
-rw-r--r--drivers/misc/gcx/gcbv/gcbv.c28
-rw-r--r--drivers/misc/gcx/gccore/gcmain.c31
-rw-r--r--drivers/misc/gcx/gccore/gcmmu.c37
3 files changed, 72 insertions, 24 deletions
diff --git a/drivers/misc/gcx/gcbv/gcbv.c b/drivers/misc/gcx/gcbv/gcbv.c
index f150068..cace819 100644
--- a/drivers/misc/gcx/gcbv/gcbv.c
+++ b/drivers/misc/gcx/gcbv/gcbv.c
@@ -521,6 +521,11 @@ static enum bverror do_map(struct bvbuffdesc *buffdesc, int client,
__func__, __LINE__, gcmap.size);
gc_map(&gcmap);
+ if (gcmap.gcerror != GCERR_NONE) {
+ BVSETERROR(BVERR_OOM,
+ "unable to allocate gccore memory");
+ goto exit;
+ }
bvbuffmapinfo = (struct bvbuffmapinfo *) bvbuffmap->handle;
bvbuffmapinfo->handle = gcmap.handle;
@@ -607,6 +612,11 @@ static enum bverror do_unmap(struct bvbuffdesc *buffdesc, int client)
/* Unmap the buffer. */
gc_unmap(&gcmap);
+ if (gcmap.gcerror != GCERR_NONE) {
+ BVSETERROR(BVERR_OOM,
+ "unable to free gccore memory");
+ goto exit;
+ }
bverror = BVERR_NONE;
@@ -840,9 +850,17 @@ static enum bverror add_fixup(struct gcbatch *batch, unsigned int *fixup,
"fixup allocation failed");
goto exit;
}
+
+ GCPRINT(GCDBGFILTER, GCZONE_FIXUP, GC_MOD_PREFIX
+ "new fixup struct allocated = 0x%08X\n",
+ __func__, __LINE__, (unsigned int) temp);
} else {
temp = gccontext.vac_fixups;
gccontext.vac_fixups = temp->next;
+
+ GCPRINT(GCDBGFILTER, GCZONE_FIXUP, GC_MOD_PREFIX
+ "fixup struct reused = 0x%08X\n",
+ __func__, __LINE__, (unsigned int) temp);
}
temp->next = NULL;
@@ -854,10 +872,6 @@ static enum bverror add_fixup(struct gcbatch *batch, unsigned int *fixup,
buffer->fixuptail->next = temp;
buffer->fixuptail = temp;
- GCPRINT(GCDBGFILTER, GCZONE_FIXUP, GC_MOD_PREFIX
- "new fixup struct allocated = 0x%08X\n",
- __func__, __LINE__, (unsigned int) temp);
-
} else {
GCPRINT(GCDBGFILTER, GCZONE_FIXUP, GC_MOD_PREFIX
"fixups accumulated = %d\n",
@@ -3759,6 +3773,8 @@ enum bverror gcbv_blt(struct bvbltparams *bltparams)
switch (srccount) {
case 0:
bverror = do_blit(bltparams, batch, NULL, 0, gca);
+ if (bverror != BVERR_NONE)
+ goto exit;
break;
case 1:
@@ -3770,6 +3786,8 @@ enum bverror gcbv_blt(struct bvbltparams *bltparams)
bverror = do_fill(bltparams, batch, srcinfo);
else
bverror = do_filter(bltparams, batch);
+ if (bverror != BVERR_NONE)
+ goto exit;
break;
case 2:
@@ -3789,6 +3807,8 @@ enum bverror gcbv_blt(struct bvbltparams *bltparams)
else
BVSETBLTERROR(BVERR_SRC1_HORZSCALE,
"scaling not supported");
+ if (bverror != BVERR_NONE)
+ goto exit;
}
}
diff --git a/drivers/misc/gcx/gccore/gcmain.c b/drivers/misc/gcx/gccore/gcmain.c
index 2dd1f73..f834491 100644
--- a/drivers/misc/gcx/gccore/gcmain.c
+++ b/drivers/misc/gcx/gccore/gcmain.c
@@ -316,6 +316,10 @@ enum gcerror gc_alloc_pages(struct gcpage *p, unsigned int size)
p->logical = dma_alloc_coherent(NULL, p->size, &p->physical,
GFP_KERNEL);
if (!p->logical) {
+ GCPRINT(NULL, 0, GC_MOD_PREFIX
+ "failed to allocate memory\n",
+ __func__, __LINE__);
+
gcerror = GCERR_OOPM;
goto fail;
}
@@ -701,7 +705,6 @@ void gc_commit(struct gccommit *gccommit, int fromuser)
unsigned int address;
struct gcmopipesel *gcmopipesel;
struct gccontextmap *context;
- struct gccommit kgccommit;
GCPRINT(GCDBGFILTER, GCZONE_COMMIT, "++" GC_MOD_PREFIX
"\n", __func__, __LINE__);
@@ -712,8 +715,8 @@ void gc_commit(struct gccommit *gccommit, int fromuser)
gc_set_power(GCPWR_ON);
/* Locate the client entry. */
- kgccommit.gcerror = find_context(&context, true);
- if (kgccommit.gcerror != GCERR_NONE)
+ gccommit->gcerror = find_context(&context, true);
+ if (gccommit->gcerror != GCERR_NONE)
goto exit;
context->context->mmu_dirty = true;
@@ -812,7 +815,9 @@ exit:
mutex_unlock(&mtx);
GCPRINT(GCDBGFILTER, GCZONE_COMMIT, "--" GC_MOD_PREFIX
- "\n", __func__, __LINE__);
+ "gc%s = 0x%08X\n", __func__, __LINE__,
+ (gccommit->gcerror == GCERR_NONE) ? "result" : "error",
+ gccommit->gcerror);
}
EXPORT_SYMBOL(gc_commit);
@@ -821,7 +826,6 @@ void gc_map(struct gcmap *gcmap)
struct mmu2dphysmem mem;
struct mmu2darena *mapped = NULL;
struct gccontextmap *context;
- struct gcmap kgcmap;
GCPRINT(GCDBGFILTER, GCZONE_MAPPING, "++" GC_MOD_PREFIX
"\n", __func__, __LINE__);
@@ -829,8 +833,8 @@ void gc_map(struct gcmap *gcmap)
mutex_lock(&mtx);
/* Locate the client entry. */
- kgcmap.gcerror = find_context(&context, true);
- if (kgcmap.gcerror != GCERR_NONE)
+ gcmap->gcerror = find_context(&context, true);
+ if (gcmap->gcerror != GCERR_NONE)
goto exit;
context->context->mmu_dirty = true;
@@ -887,14 +891,15 @@ exit:
mutex_unlock(&mtx);
GCPRINT(GCDBGFILTER, GCZONE_MAPPING, "--" GC_MOD_PREFIX
- "\n", __func__, __LINE__);
+ "gc%s = 0x%08X\n", __func__, __LINE__,
+ (gcmap->gcerror == GCERR_NONE) ? "result" : "error",
+ gcmap->gcerror);
}
EXPORT_SYMBOL(gc_map);
void gc_unmap(struct gcmap *gcmap)
{
struct gccontextmap *context;
- struct gcmap kgcmap;
GCPRINT(GCDBGFILTER, GCZONE_MAPPING, "++" GC_MOD_PREFIX
"\n", __func__, __LINE__);
@@ -902,8 +907,8 @@ void gc_unmap(struct gcmap *gcmap)
mutex_lock(&mtx);
/* Locate the client entry. */
- kgcmap.gcerror = find_context(&context, true);
- if (kgcmap.gcerror != GCERR_NONE)
+ gcmap->gcerror = find_context(&context, true);
+ if (gcmap->gcerror != GCERR_NONE)
goto exit;
context->context->mmu_dirty = true;
@@ -936,7 +941,9 @@ exit:
mutex_unlock(&mtx);
GCPRINT(GCDBGFILTER, GCZONE_MAPPING, "--" GC_MOD_PREFIX
- "\n", __func__, __LINE__);
+ "gc%s = 0x%08X\n", __func__, __LINE__,
+ (gcmap->gcerror == GCERR_NONE) ? "result" : "error",
+ gcmap->gcerror);
}
EXPORT_SYMBOL(gc_unmap);
diff --git a/drivers/misc/gcx/gccore/gcmmu.c b/drivers/misc/gcx/gccore/gcmmu.c
index 808697c..e7c1c9c 100644
--- a/drivers/misc/gcx/gccore/gcmmu.c
+++ b/drivers/misc/gcx/gccore/gcmmu.c
@@ -164,10 +164,20 @@ static enum gcerror mmu2d_allocate_slave(struct mmu2dcontext *ctxt,
struct mmu2dstlbblock *block;
struct mmu2dstlb *temp;
+ GCPRINT(GCDBGFILTER, GCZONE_MAPPING, "++" GC_MOD_PREFIX
+ "\n", __func__, __LINE__);
+
if (ctxt->slave_recs == NULL) {
block = kmalloc(STLB_PREALLOC_SIZE, GFP_KERNEL);
- if (block == NULL)
- return GCERR_SETGRP(GCERR_OODM, GCERR_MMU_STLB_ALLOC);
+ if (block == NULL) {
+ GCPRINT(NULL, 0, GC_MOD_PREFIX
+ "failed to allocate slave page table wrapper\n",
+ __func__, __LINE__);
+
+ gcerror = GCERR_SETGRP(GCERR_OODM,
+ GCERR_MMU_STLB_ALLOC);
+ goto exit;
+ }
block->next = ctxt->slave_blocks;
ctxt->slave_blocks = block;
@@ -181,8 +191,14 @@ static enum gcerror mmu2d_allocate_slave(struct mmu2dcontext *ctxt,
}
gcerror = gc_alloc_pages(&ctxt->slave_recs->pages, MMU_STLB_SIZE);
- if (gcerror != GCERR_NONE)
- return GCERR_SETGRP(gcerror, GCERR_MMU_STLB_ALLOC);
+ if (gcerror != GCERR_NONE) {
+ GCPRINT(NULL, 0, GC_MOD_PREFIX
+ "failed to allocate slave page table\n",
+ __func__, __LINE__);
+
+ gcerror = GCERR_SETGRP(gcerror, GCERR_MMU_STLB_ALLOC);
+ goto exit;
+ }
/* Remove from the list of available records. */
temp = ctxt->slave_recs;
@@ -194,9 +210,14 @@ static enum gcerror mmu2d_allocate_slave(struct mmu2dcontext *ctxt,
/* Reset allocated entry count. */
temp->count = 0;
-
*stlb = temp;
- return GCERR_NONE;
+
+exit:
+ GCPRINT(GCDBGFILTER, GCZONE_MAPPING, "--" GC_MOD_PREFIX
+ "gc%s = 0x%08X\n", __func__, __LINE__,
+ (gcerror == GCERR_NONE) ? "result" : "error", gcerror);
+
+ return gcerror;
}
#endif
@@ -642,8 +663,8 @@ enum gcerror mmu2d_map(struct mmu2dcontext *ctxt, struct mmu2dphysmem *mem,
" stlb=%d\n",
__func__, __LINE__, vacant->stlb);
GCPRINT(GCDBGFILTER, GCZONE_MAPPING, GC_MOD_PREFIX
- " count=%d\n",
- __func__, __LINE__, vacant->count);
+ " count=%d (needed %d)\n",
+ __func__, __LINE__, vacant->count, mem->count);
/*
* Create page array.