diff options
author | Ian Romanick <idr@us.ibm.com> | 2007-07-19 19:08:47 -0700 |
---|---|---|
committer | Ian Romanick <idr@us.ibm.com> | 2007-07-19 19:08:47 -0700 |
commit | 970674f4867d65bd16cf3585d46930b72a827cce (patch) | |
tree | 217ba771845101db63e1bfac5c1a7fe266380937 /linux-core | |
parent | a33f5487296eacf503f5b27ba829f5fbdae8e63b (diff) |
Fix error handing related to xgi_cmdlist_initialize.
xgi_cmdlist_initialize wasn't correctly checking for errors from
xgi_pcie_alloc. Furthermore, xgi_bootstrap, the one caller of
xgi_cmdlist_initialize, wasn't check its return value.
Diffstat (limited to 'linux-core')
-rw-r--r-- | linux-core/xgi_cmdlist.c | 10 | ||||
-rw-r--r-- | linux-core/xgi_drv.c | 6 |
2 files changed, 10 insertions, 6 deletions
diff --git a/linux-core/xgi_cmdlist.c b/linux-core/xgi_cmdlist.c index 2fdfcc91..885b5066 100644 --- a/linux-core/xgi_cmdlist.c +++ b/linux-core/xgi_cmdlist.c @@ -45,11 +45,11 @@ int xgi_cmdlist_initialize(struct xgi_info * info, size_t size) .size = size, .owner = PCIE_2D, }; + int err; - xgi_pcie_alloc(info, &mem_alloc, 0); - - if ((mem_alloc.size == 0) && (mem_alloc.hw_addr == 0)) { - return -1; + err = xgi_pcie_alloc(info, &mem_alloc, 0); + if (err) { + return err; } s_cmdring._cmdRingSize = mem_alloc.size; @@ -58,7 +58,7 @@ int xgi_cmdlist_initialize(struct xgi_info * info, size_t size) s_cmdring._lastBatchStartAddr = 0; s_cmdring._cmdRingOffset = 0; - return 1; + return 0; } static void xgi_submit_cmdlist(struct xgi_info * info, diff --git a/linux-core/xgi_drv.c b/linux-core/xgi_drv.c index 13e79169..c4e7daae 100644 --- a/linux-core/xgi_drv.c +++ b/linux-core/xgi_drv.c @@ -231,7 +231,11 @@ int xgi_bootstrap(DRM_IOCTL_ARGS) } /* Alloc 1M bytes for cmdbuffer which is flush2D batch array */ - xgi_cmdlist_initialize(info, 0x100000); + err = xgi_cmdlist_initialize(info, 0x100000); + if (err) { + DRM_ERROR("xgi_cmdlist_initialize() failed\n"); + return err; + } info->bootstrap_done = 1; return 0; |