summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Romanick <idr@us.ibm.com>2007-06-29 21:05:16 -0700
committerIan Romanick <idr@us.ibm.com>2007-06-29 21:05:16 -0700
commit4c4780bc8e5bf01b2b920c6b8de4ddbd0256c81f (patch)
treefaf2859c613acd780827ef15ece0d903f0def339
parente206c4c59da0e81ed65796d543c311fc7e30b19a (diff)
Stop-gap fix in xgi_submit_cmdlist
Comment in the code explains it. Basically, I put an if-statement around a block of code to prevent a NULL pointer dereference that should never happen in the first place. Eventually, this will need to come out.
-rw-r--r--linux-core/xgi_cmdlist.c29
1 files changed, 18 insertions, 11 deletions
diff --git a/linux-core/xgi_cmdlist.c b/linux-core/xgi_cmdlist.c
index b67a40f6..f8aacea2 100644
--- a/linux-core/xgi_cmdlist.c
+++ b/linux-core/xgi_cmdlist.c
@@ -198,17 +198,24 @@ void xgi_submit_cmdlist(struct xgi_info * info, struct xgi_cmd_info * pCmdInfo)
(U32 *) xgi_find_pcie_virt(info,
s_cmdring._lastBatchStartAddr);
- lastBatchVirtAddr[1] =
- BEGIN_LINK_ENABLE_MASK + pCmdInfo->_firstSize;
- lastBatchVirtAddr[2] = pCmdInfo->_firstBeginAddr >> 4;
- lastBatchVirtAddr[3] = 0;
- //barrier();
- lastBatchVirtAddr[0] =
- (beginPort << 22) + (BEGIN_VALID_MASK) +
- (0xffff & pCmdInfo->_curDebugID);
-
- /* Jong 06/12/2006; system hang; marked for test */
- triggerHWCommandList(info, pCmdInfo->_beginCount);
+ /* lastBatchVirtAddr should *never* be NULL. However, there
+ * are currently some bugs that cause this to happen. The
+ * if-statement here prevents some fatal (i.e., hard lock
+ * requiring the reset button) oopses.
+ */
+ if (lastBatchVirtAddr) {
+ lastBatchVirtAddr[1] =
+ BEGIN_LINK_ENABLE_MASK + pCmdInfo->_firstSize;
+ lastBatchVirtAddr[2] = pCmdInfo->_firstBeginAddr >> 4;
+ lastBatchVirtAddr[3] = 0;
+ //barrier();
+ lastBatchVirtAddr[0] =
+ (beginPort << 22) + (BEGIN_VALID_MASK) +
+ (0xffff & pCmdInfo->_curDebugID);
+
+ /* Jong 06/12/2006; system hang; marked for test */
+ triggerHWCommandList(info, pCmdInfo->_beginCount);
+ }
XGI_INFO
("Jong-xgi_submit_cmdlist-s_cmdring._lastBatchStartAddr != 0 - End\n");