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.main
parent
a33f548729
commit
970674f486
|
@ -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,
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue