mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-13 12:06:49 +00:00
drm/nouveau: sgdma: add comment around suspiscious error handler
Common programming sense dictates that resources allocated by a function are freed by this function should it fails, but this is not the case for the allocated structure of nouveau_sgdma_create_ttm(). It seems that n00b contributors attempt to fix this one like bugs flying towards a bug zapper, so add a comment to hopefully prevent this from happening anymore. Signed-off-by: Alexandre Courbot <acourbot@nvidia.com> Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
This commit is contained in:
parent
2474ae2942
commit
495b21761a
1 changed files with 5 additions and 0 deletions
|
@ -106,6 +106,11 @@ nouveau_sgdma_create_ttm(struct ttm_bo_device *bdev,
|
||||||
nvbe->ttm.ttm.func = &nv50_sgdma_backend;
|
nvbe->ttm.ttm.func = &nv50_sgdma_backend;
|
||||||
|
|
||||||
if (ttm_dma_tt_init(&nvbe->ttm, bdev, size, page_flags, dummy_read_page))
|
if (ttm_dma_tt_init(&nvbe->ttm, bdev, size, page_flags, dummy_read_page))
|
||||||
|
/*
|
||||||
|
* A failing ttm_dma_tt_init() will call ttm_tt_destroy()
|
||||||
|
* and thus our nouveau_sgdma_destroy() hook, so we don't need
|
||||||
|
* to free nvbe here.
|
||||||
|
*/
|
||||||
return NULL;
|
return NULL;
|
||||||
return &nvbe->ttm.ttm;
|
return &nvbe->ttm.ttm;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue