Skip to content

Commit 11beb0f

Browse files
cazouhverkuil
authored andcommitted
media: verisilicon: Free post processor buffers on error
During initialization, the post processor allocates the same number of buffers as the buf queue. As the init function is called in streamon(), if an allocation fails, streamon will return an error and streamoff() will not be called, keeping all post processor buffers allocated. To avoid that, all post proc buffers are freed in case of an allocation error. Fixes: 2671149 ("media: verisilicon: Refactor postprocessor to store more buffers") Signed-off-by: Detlev Casanova <[email protected]> Reviewed-by: Nicolas Dufresne <[email protected]> Signed-off-by: Nicolas Dufresne <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
1 parent 59f94c5 commit 11beb0f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/media/platform/verisilicon/hantro_postproc.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,8 +250,10 @@ int hantro_postproc_init(struct hantro_ctx *ctx)
250250

251251
for (i = 0; i < num_buffers; i++) {
252252
ret = hantro_postproc_alloc(ctx, i);
253-
if (ret)
253+
if (ret) {
254+
hantro_postproc_free(ctx);
254255
return ret;
256+
}
255257
}
256258

257259
return 0;

0 commit comments

Comments
 (0)