mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-07-24 05:40:09 -04:00
media: nuvoton: npcm-video: fix error handling in npcm_video_init()
npcm_video_init() has two error handling issues after
of_reserved_mem_device_init() is called:
When dma_set_mask_and_coherent() fails, the function releases the
reserved memory but does not return, allowing execution to fall through
into npcm_video_ece_init() with a failed DMA configuration.
When npcm_video_ece_init() fails, the function returns an error without
calling of_reserved_mem_device_release(), leaking the reserved memory
association.
Fix both by adding the missing return after the DMA mask failure and
adding the missing of_reserved_mem_device_release() call on the ECE init
error path.
Fixes: 46c15a4ff1 ("media: nuvoton: Add driver for NPCM video capture and encoding engine")
Cc: stable@vger.kernel.org
Signed-off-by: David Carlier <devnexen@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
This commit is contained in:
committed by
Hans Verkuil
parent
54e8f98885
commit
60ca00792b
@@ -1720,10 +1720,12 @@ static int npcm_video_init(struct npcm_video *video)
|
||||
if (rc) {
|
||||
dev_err(dev, "Failed to set DMA mask\n");
|
||||
of_reserved_mem_device_release(dev);
|
||||
return rc;
|
||||
}
|
||||
|
||||
rc = npcm_video_ece_init(video);
|
||||
if (rc) {
|
||||
of_reserved_mem_device_release(dev);
|
||||
dev_err(dev, "Failed to initialize ECE\n");
|
||||
return rc;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user