diff mbox series

drm/etnaviv: clean up etnaviv_gem_new_handle

Message ID 20190415131248.25968-1-l.stach@pengutronix.de (mailing list archive)
State New, archived
Headers show
Series drm/etnaviv: clean up etnaviv_gem_new_handle | expand

Commit Message

Lucas Stach April 15, 2019, 1:12 p.m. UTC
Setting the GFP flags does not need a new code block if moved to
the right location, which makes this function a bit easier to read.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
 drivers/gpu/drm/etnaviv/etnaviv_gem.c | 24 +++++++++---------------
 1 file changed, 9 insertions(+), 15 deletions(-)

Comments

Philipp Zabel April 15, 2019, 1:16 p.m. UTC | #1
On Mon, 2019-04-15 at 15:12 +0200, Lucas Stach wrote:
> Setting the GFP flags does not need a new code block if moved to
> the right location, which makes this function a bit easier to read.
> 
> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>

Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>

regards
Philipp
Christian Gmeiner April 15, 2019, 2:20 p.m. UTC | #2
Am Mo., 15. Apr. 2019 um 15:12 Uhr schrieb Lucas Stach <l.stach@pengutronix.de>:
>
> Setting the GFP flags does not need a new code block if moved to
> the right location, which makes this function a bit easier to read.
>
> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>

Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>

> ---
>  drivers/gpu/drm/etnaviv/etnaviv_gem.c | 24 +++++++++---------------
>  1 file changed, 9 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem.c b/drivers/gpu/drm/etnaviv/etnaviv_gem.c
> index 1fa74226db91..9ac9da1a769d 100644
> --- a/drivers/gpu/drm/etnaviv/etnaviv_gem.c
> +++ b/drivers/gpu/drm/etnaviv/etnaviv_gem.c
> @@ -628,24 +628,18 @@ int etnaviv_gem_new_handle(struct drm_device *dev, struct drm_file *file,
>         lockdep_set_class(&to_etnaviv_bo(obj)->lock, &etnaviv_shm_lock_class);
>
>         ret = drm_gem_object_init(dev, obj, size);
> -       if (ret == 0) {
> -               struct address_space *mapping;
> -
> -               /*
> -                * Our buffers are kept pinned, so allocating them
> -                * from the MOVABLE zone is a really bad idea, and
> -                * conflicts with CMA. See comments above new_inode()
> -                * why this is required _and_ expected if you're
> -                * going to pin these pages.
> -                */
> -               mapping = obj->filp->f_mapping;
> -               mapping_set_gfp_mask(mapping, GFP_HIGHUSER |
> -                                    __GFP_RETRY_MAYFAIL | __GFP_NOWARN);
> -       }
> -
>         if (ret)
>                 goto fail;
>
> +       /*
> +        * Our buffers are kept pinned, so allocating them from the MOVABLE
> +        * zone is a really bad idea, and conflicts with CMA. See comments
> +        * above new_inode() why this is required _and_ expected if you're
> +        * going to pin these pages.
> +        */
> +       mapping_set_gfp_mask(obj->filp->f_mapping, GFP_HIGHUSER |
> +                            __GFP_RETRY_MAYFAIL | __GFP_NOWARN);
> +
>         etnaviv_gem_obj_add(dev, obj);
>
>         ret = drm_gem_handle_create(file, obj, handle);
> --
> 2.20.1
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem.c b/drivers/gpu/drm/etnaviv/etnaviv_gem.c
index 1fa74226db91..9ac9da1a769d 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_gem.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_gem.c
@@ -628,24 +628,18 @@  int etnaviv_gem_new_handle(struct drm_device *dev, struct drm_file *file,
 	lockdep_set_class(&to_etnaviv_bo(obj)->lock, &etnaviv_shm_lock_class);
 
 	ret = drm_gem_object_init(dev, obj, size);
-	if (ret == 0) {
-		struct address_space *mapping;
-
-		/*
-		 * Our buffers are kept pinned, so allocating them
-		 * from the MOVABLE zone is a really bad idea, and
-		 * conflicts with CMA. See comments above new_inode()
-		 * why this is required _and_ expected if you're
-		 * going to pin these pages.
-		 */
-		mapping = obj->filp->f_mapping;
-		mapping_set_gfp_mask(mapping, GFP_HIGHUSER |
-				     __GFP_RETRY_MAYFAIL | __GFP_NOWARN);
-	}
-
 	if (ret)
 		goto fail;
 
+	/*
+	 * Our buffers are kept pinned, so allocating them from the MOVABLE
+	 * zone is a really bad idea, and conflicts with CMA. See comments
+	 * above new_inode() why this is required _and_ expected if you're
+	 * going to pin these pages.
+	 */
+	mapping_set_gfp_mask(obj->filp->f_mapping, GFP_HIGHUSER |
+			     __GFP_RETRY_MAYFAIL | __GFP_NOWARN);
+
 	etnaviv_gem_obj_add(dev, obj);
 
 	ret = drm_gem_handle_create(file, obj, handle);