media: verisilicon: Free post processor buffers on error
[ Upstream commit 11beb0fc346e00c412b3bfd19013206f6b655604 ]
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: 26711491a8 ("media: verisilicon: Refactor postprocessor to store more buffers")
Signed-off-by: Detlev Casanova <detlev.casanova@collabora.com>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
7b6050a9ef
commit
9e710dc96f
@@ -260,8 +260,10 @@ int hantro_postproc_init(struct hantro_ctx *ctx)
|
||||
|
||||
for (i = 0; i < num_buffers; i++) {
|
||||
ret = hantro_postproc_alloc(ctx, i);
|
||||
if (ret)
|
||||
if (ret) {
|
||||
hantro_postproc_free(ctx);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user