Message ID | 20230323131704.414281-1-benjamin.gaignard@collabora.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | media: verisilicon: Simplify error handling in tile_buffer_reallocate() | expand |
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 >
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 >
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; }
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(-)