dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/mm: Fix an error handling path in '__igt_once()'
@ 2020-05-17  8:50 Christophe JAILLET
  2020-05-17  9:01 ` Chris Wilson
  0 siblings, 1 reply; 2+ messages in thread
From: Christophe JAILLET @ 2020-05-17  8:50 UTC (permalink / raw)
  To: airlied, daniel, gregkh, tglx, chris, tvrtko.ursulin, joonas.lahtinen
  Cc: Christophe JAILLET, kernel-janitors, linux-kernel, dri-devel

The label of the last gotos must be switched for the error handling code to
work as expected.

Fixes: 83bc4ec37210 ("drm/mm: Add a search-by-address variant to only inspect a single hole")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/gpu/drm/selftests/test-drm_mm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/selftests/test-drm_mm.c b/drivers/gpu/drm/selftests/test-drm_mm.c
index 9aabe82dcd3a..af38c4fa4db5 100644
--- a/drivers/gpu/drm/selftests/test-drm_mm.c
+++ b/drivers/gpu/drm/selftests/test-drm_mm.c
@@ -1864,14 +1864,14 @@ static int __igt_once(unsigned int mode)
 		pr_err("Unexpectedly inserted the node into the wrong hole: node.start=%llx\n",
 		       node.start);
 		err = -EINVAL;
-		goto err_node;
+		goto err_hi;
 	}
 
 	err = drm_mm_insert_node_generic(&mm, &node, 2, 0, 0, mode);
 	if (err) {
 		pr_err("Could not insert the node into the available hole!\n");
 		err = -EINVAL;
-		goto err_hi;
+		goto err_node;
 	}
 
 err_node:
-- 
2.25.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] drm/mm: Fix an error handling path in '__igt_once()'
  2020-05-17  8:50 [PATCH] drm/mm: Fix an error handling path in '__igt_once()' Christophe JAILLET
@ 2020-05-17  9:01 ` Chris Wilson
  0 siblings, 0 replies; 2+ messages in thread
From: Chris Wilson @ 2020-05-17  9:01 UTC (permalink / raw)
  To: Christophe JAILLET, airlied, daniel, gregkh, joonas.lahtinen,
	tglx, tvrtko.ursulin
  Cc: Christophe JAILLET, kernel-janitors, linux-kernel, dri-devel

Quoting Christophe JAILLET (2020-05-17 09:50:49)
> The label of the last gotos must be switched for the error handling code to
> work as expected.
> 
> Fixes: 83bc4ec37210 ("drm/mm: Add a search-by-address variant to only inspect a single hole")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
>  drivers/gpu/drm/selftests/test-drm_mm.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/selftests/test-drm_mm.c b/drivers/gpu/drm/selftests/test-drm_mm.c
> index 9aabe82dcd3a..af38c4fa4db5 100644
> --- a/drivers/gpu/drm/selftests/test-drm_mm.c
> +++ b/drivers/gpu/drm/selftests/test-drm_mm.c
> @@ -1864,14 +1864,14 @@ static int __igt_once(unsigned int mode)
>                 pr_err("Unexpectedly inserted the node into the wrong hole: node.start=%llx\n",
>                        node.start);
>                 err = -EINVAL;
> -               goto err_node;
> +               goto err_hi;

This needs to call drm_mm_remove_node() [err_node:] as it accidentally inserted the
node.

>         }
>  
>         err = drm_mm_insert_node_generic(&mm, &node, 2, 0, 0, mode);
>         if (err) {
>                 pr_err("Could not insert the node into the available hole!\n");
>                 err = -EINVAL;
> -               goto err_hi;
> +               goto err_node;

And this must *not* call drm_mm_remove_node.
-Chris
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-05-18 10:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-17  8:50 [PATCH] drm/mm: Fix an error handling path in '__igt_once()' Christophe JAILLET
2020-05-17  9:01 ` Chris Wilson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).