All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] media: verisilicon: Simplify error handling in tile_buffer_reallocate()
@ 2023-03-23 13:17 ` Benjamin Gaignard
  0 siblings, 0 replies; 8+ messages in thread
From: Benjamin Gaignard @ 2023-03-23 13:17 UTC (permalink / raw)
  To: ezequiel, p.zabel, mchehab, elfring
  Cc: linux-media, linux-rockchip, linux-kernel, kernel, Benjamin Gaignard

Rework allocation errors cases handling to simply it
by removing useless tests.

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com>
Reported-by: Markus Elfring <elfring@users.sourceforge.net>
---
 .../media/platform/verisilicon/hantro_hevc.c  | 23 ++++++++-----------
 1 file changed, 9 insertions(+), 14 deletions(-)

diff --git a/drivers/media/platform/verisilicon/hantro_hevc.c b/drivers/media/platform/verisilicon/hantro_hevc.c
index 9383fb7081f6..2c14330bc562 100644
--- a/drivers/media/platform/verisilicon/hantro_hevc.c
+++ b/drivers/media/platform/verisilicon/hantro_hevc.c
@@ -109,7 +109,7 @@ static int tile_buffer_reallocate(struct hantro_ctx *ctx)
 						       &hevc_dec->tile_filter.dma,
 						       GFP_KERNEL);
 	if (!hevc_dec->tile_filter.cpu)
-		goto err_free_tile_buffers;
+		return -ENOMEM;
 	hevc_dec->tile_filter.size = size;
 
 	size = (VERT_SAO_RAM_SIZE * height64 * (num_tile_cols - 1) * ctx->bit_depth) / 8;
@@ -125,31 +125,26 @@ static int tile_buffer_reallocate(struct hantro_ctx *ctx)
 						    &hevc_dec->tile_bsd.dma,
 						    GFP_KERNEL);
 	if (!hevc_dec->tile_bsd.cpu)
-		goto err_free_tile_buffers;
+		goto err_free_sao_buffers;
 	hevc_dec->tile_bsd.size = size;
 
 	hevc_dec->num_tile_cols_allocated = num_tile_cols;
 
 	return 0;
 
-err_free_tile_buffers:
-	if (hevc_dec->tile_filter.cpu)
-		dma_free_coherent(vpu->dev, hevc_dec->tile_filter.size,
-				  hevc_dec->tile_filter.cpu,
-				  hevc_dec->tile_filter.dma);
-	hevc_dec->tile_filter.cpu = NULL;
-
+err_free_sao_buffers:
 	if (hevc_dec->tile_sao.cpu)
 		dma_free_coherent(vpu->dev, hevc_dec->tile_sao.size,
 				  hevc_dec->tile_sao.cpu,
 				  hevc_dec->tile_sao.dma);
 	hevc_dec->tile_sao.cpu = NULL;
 
-	if (hevc_dec->tile_bsd.cpu)
-		dma_free_coherent(vpu->dev, hevc_dec->tile_bsd.size,
-				  hevc_dec->tile_bsd.cpu,
-				  hevc_dec->tile_bsd.dma);
-	hevc_dec->tile_bsd.cpu = NULL;
+err_free_tile_buffers:
+	if (hevc_dec->tile_filter.cpu)
+		dma_free_coherent(vpu->dev, hevc_dec->tile_filter.size,
+				  hevc_dec->tile_filter.cpu,
+				  hevc_dec->tile_filter.dma);
+	hevc_dec->tile_filter.cpu = NULL;
 
 	return -ENOMEM;
 }
-- 
2.34.1


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

* [PATCH] media: verisilicon: Simplify error handling in tile_buffer_reallocate()
@ 2023-03-23 13:17 ` Benjamin Gaignard
  0 siblings, 0 replies; 8+ messages in thread
From: Benjamin Gaignard @ 2023-03-23 13:17 UTC (permalink / raw)
  To: ezequiel, p.zabel, mchehab, elfring
  Cc: linux-media, linux-rockchip, linux-kernel, kernel, Benjamin Gaignard

Rework allocation errors cases handling to simply it
by removing useless tests.

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com>
Reported-by: Markus Elfring <elfring@users.sourceforge.net>
---
 .../media/platform/verisilicon/hantro_hevc.c  | 23 ++++++++-----------
 1 file changed, 9 insertions(+), 14 deletions(-)

diff --git a/drivers/media/platform/verisilicon/hantro_hevc.c b/drivers/media/platform/verisilicon/hantro_hevc.c
index 9383fb7081f6..2c14330bc562 100644
--- a/drivers/media/platform/verisilicon/hantro_hevc.c
+++ b/drivers/media/platform/verisilicon/hantro_hevc.c
@@ -109,7 +109,7 @@ static int tile_buffer_reallocate(struct hantro_ctx *ctx)
 						       &hevc_dec->tile_filter.dma,
 						       GFP_KERNEL);
 	if (!hevc_dec->tile_filter.cpu)
-		goto err_free_tile_buffers;
+		return -ENOMEM;
 	hevc_dec->tile_filter.size = size;
 
 	size = (VERT_SAO_RAM_SIZE * height64 * (num_tile_cols - 1) * ctx->bit_depth) / 8;
@@ -125,31 +125,26 @@ static int tile_buffer_reallocate(struct hantro_ctx *ctx)
 						    &hevc_dec->tile_bsd.dma,
 						    GFP_KERNEL);
 	if (!hevc_dec->tile_bsd.cpu)
-		goto err_free_tile_buffers;
+		goto err_free_sao_buffers;
 	hevc_dec->tile_bsd.size = size;
 
 	hevc_dec->num_tile_cols_allocated = num_tile_cols;
 
 	return 0;
 
-err_free_tile_buffers:
-	if (hevc_dec->tile_filter.cpu)
-		dma_free_coherent(vpu->dev, hevc_dec->tile_filter.size,
-				  hevc_dec->tile_filter.cpu,
-				  hevc_dec->tile_filter.dma);
-	hevc_dec->tile_filter.cpu = NULL;
-
+err_free_sao_buffers:
 	if (hevc_dec->tile_sao.cpu)
 		dma_free_coherent(vpu->dev, hevc_dec->tile_sao.size,
 				  hevc_dec->tile_sao.cpu,
 				  hevc_dec->tile_sao.dma);
 	hevc_dec->tile_sao.cpu = NULL;
 
-	if (hevc_dec->tile_bsd.cpu)
-		dma_free_coherent(vpu->dev, hevc_dec->tile_bsd.size,
-				  hevc_dec->tile_bsd.cpu,
-				  hevc_dec->tile_bsd.dma);
-	hevc_dec->tile_bsd.cpu = NULL;
+err_free_tile_buffers:
+	if (hevc_dec->tile_filter.cpu)
+		dma_free_coherent(vpu->dev, hevc_dec->tile_filter.size,
+				  hevc_dec->tile_filter.cpu,
+				  hevc_dec->tile_filter.dma);
+	hevc_dec->tile_filter.cpu = NULL;
 
 	return -ENOMEM;
 }
-- 
2.34.1


_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

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

* Re: [PATCH] media: verisilicon: Simplify error handling in tile_buffer_reallocate()
  2023-03-23 13:17 ` Benjamin Gaignard
  (?)
@ 2023-03-24  6:37 ` Markus Elfring
  2023-03-24  8:10     ` Benjamin Gaignard
  -1 siblings, 1 reply; 8+ messages in thread
From: Markus Elfring @ 2023-03-24  6:37 UTC (permalink / raw)
  To: Benjamin Gaignard, Ezequiel Garcia, Philipp Zabel,
	Mauro Carvalho Chehab, kernel-janitors
  Cc: linux-media, linux-rockchip, linux-kernel, kernel


> Rework allocation errors cases handling to simply it
> by removing useless tests.

How do you think about to use a wording like “Simplify handling of allocation
error cases by removing useless tests.” for your change description?


> Reported-by: …
> ---
>  .../media/platform/verisilicon/hantro_hevc.c  | 23 ++++++++-----------

Would you like to add any links for corresponding information?

Regards,
Markus

_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

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

* Re: [PATCH] media: verisilicon: Simplify error handling in tile_buffer_reallocate()
  2023-03-24  6:37 ` Markus Elfring
@ 2023-03-24  8:10     ` Benjamin Gaignard
  0 siblings, 0 replies; 8+ messages in thread
From: Benjamin Gaignard @ 2023-03-24  8:10 UTC (permalink / raw)
  To: Markus Elfring, Ezequiel Garcia, Philipp Zabel,
	Mauro Carvalho Chehab, kernel-janitors
  Cc: linux-media, linux-rockchip, linux-kernel, kernel


Le 24/03/2023 à 07:37, Markus Elfring a écrit :
>> Rework allocation errors cases handling to simply it
>> by removing useless tests.
> How do you think about to use a wording like “Simplify handling of allocation
> error cases by removing useless tests.” for your change description?
>
>
>> Reported-by: …
>> ---
>>   .../media/platform/verisilicon/hantro_hevc.c  | 23 ++++++++-----------
> Would you like to add any links for corresponding information?

No, it was just to show that you have reported the possible clean up

Regards,
Benjamin

>
> Regards,
> Markus
>

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

* Re: [PATCH] media: verisilicon: Simplify error handling in tile_buffer_reallocate()
@ 2023-03-24  8:10     ` Benjamin Gaignard
  0 siblings, 0 replies; 8+ messages in thread
From: Benjamin Gaignard @ 2023-03-24  8:10 UTC (permalink / raw)
  To: Markus Elfring, Ezequiel Garcia, Philipp Zabel,
	Mauro Carvalho Chehab, kernel-janitors
  Cc: linux-media, linux-rockchip, linux-kernel, kernel


Le 24/03/2023 à 07:37, Markus Elfring a écrit :
>> Rework allocation errors cases handling to simply it
>> by removing useless tests.
> How do you think about to use a wording like “Simplify handling of allocation
> error cases by removing useless tests.” for your change description?
>
>
>> Reported-by: …
>> ---
>>   .../media/platform/verisilicon/hantro_hevc.c  | 23 ++++++++-----------
> Would you like to add any links for corresponding information?

No, it was just to show that you have reported the possible clean up

Regards,
Benjamin

>
> Regards,
> Markus
>

_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

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

* Re: media: verisilicon: Simplify error handling in tile_buffer_reallocate()
  2023-03-24  8:10     ` Benjamin Gaignard
  (?)
@ 2023-03-24  9:55     ` Markus Elfring
  2023-03-24 10:30         ` Benjamin Gaignard
  -1 siblings, 1 reply; 8+ messages in thread
From: Markus Elfring @ 2023-03-24  9:55 UTC (permalink / raw)
  To: Benjamin Gaignard, Ezequiel Garcia, Philipp Zabel,
	Mauro Carvalho Chehab, kernel-janitors
  Cc: linux-media, linux-rockchip, linux-kernel, kernel

>>> Rework allocation errors cases handling to simply it
>>> by removing useless tests.
>> How do you think about to use a wording like “Simplify handling of allocation
>> error cases by removing useless tests.” for your change description?

I would appreciate another bit of fine-tuning for such text.


>>> Reported-by: …
>>> ---
>>>   .../media/platform/verisilicon/hantro_hevc.c  | 23 ++++++++-----------
>> Would you like to add any links for corresponding information?
>
> No, it was just to show that you have reported the possible clean up

I imagine that a bit of background information will be helpful in a tag
like “Link:” also for your patch.

2023-03-22
[PATCH] media: hantro: HEVC: Fix exception handling in tile_buffer_reallocate()

Examples:
* https://lore.kernel.org/cocci/ea112fdd-7af0-d1f1-442c-306e6ec54a5b@web.de/
  https://sympa.inria.fr/sympa/arc/cocci/2023-03/msg00037.html

* https://lore.kernel.org/lkml/5d5c8c7b-b926-8397-7994-623ac9b37e83@collabora.com/


Regards,
Markus

_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

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

* Re: media: verisilicon: Simplify error handling in tile_buffer_reallocate()
  2023-03-24  9:55     ` Markus Elfring
@ 2023-03-24 10:30         ` Benjamin Gaignard
  0 siblings, 0 replies; 8+ messages in thread
From: Benjamin Gaignard @ 2023-03-24 10:30 UTC (permalink / raw)
  To: Markus Elfring, Ezequiel Garcia, Philipp Zabel,
	Mauro Carvalho Chehab, kernel-janitors
  Cc: linux-media, linux-rockchip, linux-kernel, kernel


Le 24/03/2023 à 10:55, Markus Elfring a écrit :
>>>> Rework allocation errors cases handling to simply it
>>>> by removing useless tests.
>>> How do you think about to use a wording like “Simplify handling of allocation
>>> error cases by removing useless tests.” for your change description?
> I would appreciate another bit of fine-tuning for such text.
>
>
>>>> Reported-by: …
>>>> ---
>>>>    .../media/platform/verisilicon/hantro_hevc.c  | 23 ++++++++-----------
>>> Would you like to add any links for corresponding information?
>> No, it was just to show that you have reported the possible clean up
> I imagine that a bit of background information will be helpful in a tag
> like “Link:” also for your patch.
>
> 2023-03-22
> [PATCH] media: hantro: HEVC: Fix exception handling in tile_buffer_reallocate()
>
> Examples:
> * https://lore.kernel.org/cocci/ea112fdd-7af0-d1f1-442c-306e6ec54a5b@web.de/
>    https://sympa.inria.fr/sympa/arc/cocci/2023-03/msg00037.html
>
> * https://lore.kernel.org/lkml/5d5c8c7b-b926-8397-7994-623ac9b37e83@collabora.com/

You are welcome to propose a v3 for this patch :-)

>
>
> Regards,
> Markus
>

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

* Re: media: verisilicon: Simplify error handling in tile_buffer_reallocate()
@ 2023-03-24 10:30         ` Benjamin Gaignard
  0 siblings, 0 replies; 8+ messages in thread
From: Benjamin Gaignard @ 2023-03-24 10:30 UTC (permalink / raw)
  To: Markus Elfring, Ezequiel Garcia, Philipp Zabel,
	Mauro Carvalho Chehab, kernel-janitors
  Cc: linux-media, linux-rockchip, linux-kernel, kernel


Le 24/03/2023 à 10:55, Markus Elfring a écrit :
>>>> Rework allocation errors cases handling to simply it
>>>> by removing useless tests.
>>> How do you think about to use a wording like “Simplify handling of allocation
>>> error cases by removing useless tests.” for your change description?
> I would appreciate another bit of fine-tuning for such text.
>
>
>>>> Reported-by: …
>>>> ---
>>>>    .../media/platform/verisilicon/hantro_hevc.c  | 23 ++++++++-----------
>>> Would you like to add any links for corresponding information?
>> No, it was just to show that you have reported the possible clean up
> I imagine that a bit of background information will be helpful in a tag
> like “Link:” also for your patch.
>
> 2023-03-22
> [PATCH] media: hantro: HEVC: Fix exception handling in tile_buffer_reallocate()
>
> Examples:
> * https://lore.kernel.org/cocci/ea112fdd-7af0-d1f1-442c-306e6ec54a5b@web.de/
>    https://sympa.inria.fr/sympa/arc/cocci/2023-03/msg00037.html
>
> * https://lore.kernel.org/lkml/5d5c8c7b-b926-8397-7994-623ac9b37e83@collabora.com/

You are welcome to propose a v3 for this patch :-)

>
>
> Regards,
> Markus
>

_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

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

end of thread, other threads:[~2023-03-24 10:31 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-23 13:17 [PATCH] media: verisilicon: Simplify error handling in tile_buffer_reallocate() Benjamin Gaignard
2023-03-23 13:17 ` Benjamin Gaignard
2023-03-24  6:37 ` Markus Elfring
2023-03-24  8:10   ` Benjamin Gaignard
2023-03-24  8:10     ` Benjamin Gaignard
2023-03-24  9:55     ` Markus Elfring
2023-03-24 10:30       ` Benjamin Gaignard
2023-03-24 10:30         ` Benjamin Gaignard

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.