public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915: Fix an error handling path in igt_write_huge()
@ 2023-07-17 18:49 Christophe JAILLET
  2023-07-18 12:10 ` [Intel-gfx] " Andrzej Hajda
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Christophe JAILLET @ 2023-07-17 18:49 UTC (permalink / raw)
  To: Jani Nikula, Joonas Lahtinen, Rodrigo Vivi, Tvrtko Ursulin,
	David Airlie, Daniel Vetter, Matthew Auld, Maarten Lankhorst
  Cc: linux-kernel, kernel-janitors, Christophe JAILLET, intel-gfx,
	dri-devel

All error handling paths go to 'out', except this one. Be consistent and
also branch to 'out' here.

Fixes: c10a652e239e ("drm/i915/selftests: Rework context handling in hugepages selftests")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
/!\ Speculative /!\

   This patch is based on analysis of the surrounding code and should be
   reviewed with care !

   If the patch is wrong, maybe a comment in the code could explain why.

/!\ Speculative /!\
---
 drivers/gpu/drm/i915/gem/selftests/huge_pages.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/gem/selftests/huge_pages.c b/drivers/gpu/drm/i915/gem/selftests/huge_pages.c
index df6c9a84252c..6b9f6cf50bf6 100644
--- a/drivers/gpu/drm/i915/gem/selftests/huge_pages.c
+++ b/drivers/gpu/drm/i915/gem/selftests/huge_pages.c
@@ -1246,8 +1246,10 @@ static int igt_write_huge(struct drm_i915_private *i915,
 	 * times in succession a possibility by enlarging the permutation array.
 	 */
 	order = i915_random_order(count * count, &prng);
-	if (!order)
-		return -ENOMEM;
+	if (!order) {
+		err = -ENOMEM;
+		goto out;
+	}
 
 	max_page_size = rounddown_pow_of_two(obj->mm.page_sizes.sg);
 	max = div_u64(max - size, max_page_size);
-- 
2.34.1


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

* Re: [Intel-gfx] [PATCH] drm/i915: Fix an error handling path in igt_write_huge()
  2023-07-17 18:49 [PATCH] drm/i915: Fix an error handling path in igt_write_huge() Christophe JAILLET
@ 2023-07-18 12:10 ` Andrzej Hajda
  2023-07-24 16:24 ` Andi Shyti
  2023-07-24 16:44 ` Andi Shyti
  2 siblings, 0 replies; 4+ messages in thread
From: Andrzej Hajda @ 2023-07-18 12:10 UTC (permalink / raw)
  To: Christophe JAILLET, Jani Nikula, Joonas Lahtinen, Rodrigo Vivi,
	Tvrtko Ursulin, David Airlie, Daniel Vetter, Matthew Auld,
	Maarten Lankhorst
  Cc: intel-gfx, kernel-janitors, linux-kernel, dri-devel

On 17.07.2023 20:49, Christophe JAILLET wrote:
> All error handling paths go to 'out', except this one. Be consistent and
> also branch to 'out' here.
> 
> Fixes: c10a652e239e ("drm/i915/selftests: Rework context handling in hugepages selftests")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>


For me seems correct.

Reviewed-by: Andrzej Hajda <andrzej.hajda@intel.com>

Regards
Andrzej


> ---
> /!\ Speculative /!\
> 
>     This patch is based on analysis of the surrounding code and should be
>     reviewed with care !
> 
>     If the patch is wrong, maybe a comment in the code could explain why.
> 
> /!\ Speculative /!\
> ---
>   drivers/gpu/drm/i915/gem/selftests/huge_pages.c | 6 ++++--
>   1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/gem/selftests/huge_pages.c b/drivers/gpu/drm/i915/gem/selftests/huge_pages.c
> index df6c9a84252c..6b9f6cf50bf6 100644
> --- a/drivers/gpu/drm/i915/gem/selftests/huge_pages.c
> +++ b/drivers/gpu/drm/i915/gem/selftests/huge_pages.c
> @@ -1246,8 +1246,10 @@ static int igt_write_huge(struct drm_i915_private *i915,
>   	 * times in succession a possibility by enlarging the permutation array.
>   	 */
>   	order = i915_random_order(count * count, &prng);
> -	if (!order)
> -		return -ENOMEM;
> +	if (!order) {
> +		err = -ENOMEM;
> +		goto out;
> +	}
>   
>   	max_page_size = rounddown_pow_of_two(obj->mm.page_sizes.sg);
>   	max = div_u64(max - size, max_page_size);


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

* Re: [Intel-gfx] [PATCH] drm/i915: Fix an error handling path in igt_write_huge()
  2023-07-17 18:49 [PATCH] drm/i915: Fix an error handling path in igt_write_huge() Christophe JAILLET
  2023-07-18 12:10 ` [Intel-gfx] " Andrzej Hajda
@ 2023-07-24 16:24 ` Andi Shyti
  2023-07-24 16:44 ` Andi Shyti
  2 siblings, 0 replies; 4+ messages in thread
From: Andi Shyti @ 2023-07-24 16:24 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: Jani Nikula, Joonas Lahtinen, Rodrigo Vivi, Tvrtko Ursulin,
	David Airlie, Daniel Vetter, Matthew Auld, Maarten Lankhorst,
	intel-gfx, kernel-janitors, linux-kernel, dri-devel

Hi Christophe,

On Mon, Jul 17, 2023 at 08:49:31PM +0200, Christophe JAILLET wrote:
> All error handling paths go to 'out', except this one. Be consistent and
> also branch to 'out' here.
> 
> Fixes: c10a652e239e ("drm/i915/selftests: Rework context handling in hugepages selftests")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> /!\ Speculative /!\
> 
>    This patch is based on analysis of the surrounding code and should be
>    reviewed with care !
> 
>    If the patch is wrong, maybe a comment in the code could explain why.
> 
> /!\ Speculative /!\
> ---
>  drivers/gpu/drm/i915/gem/selftests/huge_pages.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/gem/selftests/huge_pages.c b/drivers/gpu/drm/i915/gem/selftests/huge_pages.c
> index df6c9a84252c..6b9f6cf50bf6 100644
> --- a/drivers/gpu/drm/i915/gem/selftests/huge_pages.c
> +++ b/drivers/gpu/drm/i915/gem/selftests/huge_pages.c
> @@ -1246,8 +1246,10 @@ static int igt_write_huge(struct drm_i915_private *i915,
>  	 * times in succession a possibility by enlarging the permutation array.
>  	 */
>  	order = i915_random_order(count * count, &prng);
> -	if (!order)
> -		return -ENOMEM;
> +	if (!order) {
> +		err = -ENOMEM;
> +		goto out;
> +	}

Looks good:

Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com> 

Thanks,
Andi

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

* Re: [Intel-gfx] [PATCH] drm/i915: Fix an error handling path in igt_write_huge()
  2023-07-17 18:49 [PATCH] drm/i915: Fix an error handling path in igt_write_huge() Christophe JAILLET
  2023-07-18 12:10 ` [Intel-gfx] " Andrzej Hajda
  2023-07-24 16:24 ` Andi Shyti
@ 2023-07-24 16:44 ` Andi Shyti
  2 siblings, 0 replies; 4+ messages in thread
From: Andi Shyti @ 2023-07-24 16:44 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: Jani Nikula, Joonas Lahtinen, Rodrigo Vivi, Tvrtko Ursulin,
	David Airlie, Daniel Vetter, Matthew Auld, Maarten Lankhorst,
	intel-gfx, kernel-janitors, linux-kernel, dri-devel

Hi Christophe,

> All error handling paths go to 'out', except this one. Be consistent and
> also branch to 'out' here.
> 
> Fixes: c10a652e239e ("drm/i915/selftests: Rework context handling in hugepages selftests")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

Pushed to drm-intel-gt-next.

Thanks,
Andi

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

end of thread, other threads:[~2023-07-24 16:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-17 18:49 [PATCH] drm/i915: Fix an error handling path in igt_write_huge() Christophe JAILLET
2023-07-18 12:10 ` [Intel-gfx] " Andrzej Hajda
2023-07-24 16:24 ` Andi Shyti
2023-07-24 16:44 ` Andi Shyti

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox