diff options
author | Ben Skeggs <bskeggs@redhat.com> | 2016-06-02 10:17:58 +1000 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2016-06-02 10:18:27 +1000 |
commit | bb57f9af9d179af0962456dca369953521ea8c2c (patch) | |
tree | 7d5b6cee1c87057d6095e42df009739e9a789b88 /src | |
parent | b824d36c28124955eda4aced5e637aa75eea4d6c (diff) |
fix use of out-of-scope data
Reported by Coverity.
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/nouveau_copy.c | 38 |
1 files changed, 21 insertions, 17 deletions
diff --git a/src/nouveau_copy.c b/src/nouveau_copy.c index d0b868d..e152a53 100644 --- a/src/nouveau_copy.c +++ b/src/nouveau_copy.c @@ -50,8 +50,7 @@ nouveau_copy_init(ScreenPtr pScreen) }, *method = methods; ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); NVPtr pNv = NVPTR(pScrn); - void *data; - int ret, size; + int ret; if (pNv->AccelMethod == NONE) { xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, @@ -65,30 +64,35 @@ nouveau_copy_init(ScreenPtr pScreen) pNv->dev->chipset == 0xaa || pNv->dev->chipset == 0xac) return FALSE; - data = &(struct nv04_fifo) { - .vram = NvDmaFB, - .gart = NvDmaTT, - }; - size = sizeof(struct nv04_fifo); + + ret = nouveau_object_new(&pNv->dev->object, 0, + NOUVEAU_FIFO_CHANNEL_CLASS, + &(struct nv04_fifo) { + .vram = NvDmaFB, + .gart = NvDmaTT, + }, sizeof(struct nv04_fifo), + &pNv->ce_channel); break; case NV_FERMI: - data = &(struct nvc0_fifo) {}; - size = sizeof(struct nvc0_fifo); + ret = nouveau_object_new(&pNv->dev->object, 0, + NOUVEAU_FIFO_CHANNEL_CLASS, + &(struct nvc0_fifo) { + }, sizeof(struct nvc0_fifo), + &pNv->ce_channel); break; case NV_KEPLER: - data = &(struct nve0_fifo) { - .engine = NVE0_FIFO_ENGINE_CE0 | - NVE0_FIFO_ENGINE_CE1, - }; - size = sizeof(struct nvc0_fifo); + ret = nouveau_object_new(&pNv->dev->object, 0, + NOUVEAU_FIFO_CHANNEL_CLASS, + &(struct nve0_fifo) { + .engine = NVE0_FIFO_ENGINE_CE0 | + NVE0_FIFO_ENGINE_CE1, + }, sizeof(struct nve0_fifo), + &pNv->ce_channel); break; default: return FALSE; } - ret = nouveau_object_new(&pNv->dev->object, 0, - NOUVEAU_FIFO_CHANNEL_CLASS, data, size, - &pNv->ce_channel); if (ret) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "[COPY] error allocating channel: %d\n", ret); |