From: Phil Carmody <ext-phil.2.carmody@xxxxxxxxx> There's no point checking if a pointer's null if you're going to dereference it anyway. Signed-off-by: Phil Carmody <ext-phil.2.carmody@xxxxxxxxx> Signed-off-by: Hiroshi DOYU <Hiroshi.DOYU@xxxxxxxxx> --- drivers/dsp/bridge/pmgr/dbll.c | 33 +++++++++++++++++++-------------- 1 files changed, 19 insertions(+), 14 deletions(-) diff --git a/drivers/dsp/bridge/pmgr/dbll.c b/drivers/dsp/bridge/pmgr/dbll.c index c57f557..7c3cd40 100644 --- a/drivers/dsp/bridge/pmgr/dbll.c +++ b/drivers/dsp/bridge/pmgr/dbll.c @@ -1481,6 +1481,7 @@ static int writeMem(struct Dynamic_Loader_Initialize *this, void *buf, { struct DBLLInit *pInit = (struct DBLLInit *)this; struct DBLL_LibraryObj *lib; + struct DBLL_TarObj *pTarget; struct DBLL_SectInfo sectInfo; u32 memType; bool retVal = true; @@ -1491,20 +1492,24 @@ static int writeMem(struct Dynamic_Loader_Initialize *this, void *buf, memType = (DLOAD_SECTION_TYPE(info->type) == DLOAD_TEXT) ? DBLL_CODE : DBLL_DATA; - if (lib != NULL) { - retVal = (*lib->pTarget->attrs.write)(lib->pTarget-> - attrs.wHandle, addr, buf, nBytes, memType); - } - if (lib->pTarget->attrs.logWrite) { - sectInfo.name = info->name; - sectInfo.runAddr = info->run_addr; - sectInfo.loadAddr = info->load_addr; - sectInfo.size = info->size; - sectInfo.type = memType; - /* Pass the information about what we've written to - * another module */ - (*lib->pTarget->attrs.logWrite)(lib->pTarget-> - attrs.logWriteHandle, §Info, addr, nBytes); + if ((lib != NULL) && + ((pTarget = lib->pTarget) != NULL) && + (pTarget->attrs.write != NULL)) { + retVal = (*pTarget->attrs.write)(pTarget->attrs.wHandle, + addr, buf, nBytes, memType); + + if (pTarget->attrs.logWrite) { + sectInfo.name = info->name; + sectInfo.runAddr = info->run_addr; + sectInfo.loadAddr = info->load_addr; + sectInfo.size = info->size; + sectInfo.type = memType; + /* Pass the information about what we've written to + * another module */ + (*pTarget->attrs.logWrite)( + pTarget->attrs.logWriteHandle, + §Info, addr, nBytes); + } } return retVal; } -- 1.6.0.4 -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html