Displaying 5 results from an estimated 5 matches for "nv50_sgdma_backend".
2014 Dec 10
2
[PATCH] drm: sgdma: free allocated memory if TT init fails
...hanged, 4 insertions(+), 1 deletion(-)
diff --git a/drm/nouveau_sgdma.c b/drm/nouveau_sgdma.c
index 01707e7deaf5..e4fc494d688d 100644
--- a/drm/nouveau_sgdma.c
+++ b/drm/nouveau_sgdma.c
@@ -107,7 +107,10 @@ nouveau_sgdma_create_ttm(struct ttm_bo_device *bdev,
 	else
 		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)) {
+		kfree(nvbe);
 		return NULL;
+	}
+
 	return &nvbe->ttm.ttm;
 }
-- 
2.1.3
2015 Dec 11
1
[PATCH] ttm/drm: constify ttm_backend_func structures
...backend_func nv04_sgdma_backend = {
+static const struct ttm_backend_func nv04_sgdma_backend = {
 	.bind			= nv04_sgdma_bind,
 	.unbind			= nv04_sgdma_unbind,
 	.destroy		= nouveau_sgdma_destroy
@@ -82,7 +82,7 @@ nv50_sgdma_unbind(struct ttm_tt *ttm)
 	return 0;
 }
 
-static struct ttm_backend_func nv50_sgdma_backend = {
+static const struct ttm_backend_func nv50_sgdma_backend = {
 	.bind			= nv50_sgdma_bind,
 	.unbind			= nv50_sgdma_unbind,
 	.destroy		= nouveau_sgdma_destroy
diff --git a/drivers/gpu/drm/qxl/qxl_ttm.c b/drivers/gpu/drm/qxl/qxl_ttm.c
index 0cbc4c9..93dc45d 100644
--- a/drivers/gpu/drm/qxl/qxl_t...
2015 Dec 11
1
[PATCH] ttm/drm: constify ttm_backend_func structures
...backend_func nv04_sgdma_backend = {
+static const struct ttm_backend_func nv04_sgdma_backend = {
 	.bind			= nv04_sgdma_bind,
 	.unbind			= nv04_sgdma_unbind,
 	.destroy		= nouveau_sgdma_destroy
@@ -82,7 +82,7 @@ nv50_sgdma_unbind(struct ttm_tt *ttm)
 	return 0;
 }
 
-static struct ttm_backend_func nv50_sgdma_backend = {
+static const struct ttm_backend_func nv50_sgdma_backend = {
 	.bind			= nv50_sgdma_bind,
 	.unbind			= nv50_sgdma_unbind,
 	.destroy		= nouveau_sgdma_destroy
diff --git a/drivers/gpu/drm/qxl/qxl_ttm.c b/drivers/gpu/drm/qxl/qxl_ttm.c
index 0cbc4c9..93dc45d 100644
--- a/drivers/gpu/drm/qxl/qxl_t...
2014 Dec 10
0
[PATCH] drm: sgdma: free allocated memory if TT init fails
...t a/drm/nouveau_sgdma.c b/drm/nouveau_sgdma.c
> index 01707e7deaf5..e4fc494d688d 100644
> --- a/drm/nouveau_sgdma.c
> +++ b/drm/nouveau_sgdma.c
> @@ -107,7 +107,10 @@ nouveau_sgdma_create_ttm(struct ttm_bo_device *bdev,
>         else
>                 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)) {
> +               kfree(nvbe);
>                 return NULL;
> +       }
> +
>...
2014 Dec 10
0
[PATCH] drm: sgdma: add comment around suspiscious error handler
....c | 5 +++++
 1 file changed, 5 insertions(+)
diff --git a/drm/nouveau_sgdma.c b/drm/nouveau_sgdma.c
index ec76c0b4e452..23c377a6c761 100644
--- a/drm/nouveau_sgdma.c
+++ b/drm/nouveau_sgdma.c
@@ -106,6 +106,11 @@ nouveau_sgdma_create_ttm(struct ttm_bo_device *bdev,
 		nvbe->ttm.ttm.func = &nv50_sgdma_backend;
 
 	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 &nvbe->ttm.t...