Skip to content

Commit

Permalink
[media] mantis: Fix error handling in mantis_dma_init()
Browse files Browse the repository at this point in the history
Current code assigns 0 to variable 'err', which makes mantis_dma_init()
to return success even if mantis_alloc_buffers() fails.

Fix it by checking the return value from mantis_alloc_buffers() and
propagating it in the case of error.

Reported-by: RUC_Soft_Sec <zy900702@163.com>
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
  • Loading branch information
Fabio Estevam authored and mchehab committed Aug 19, 2015
1 parent 72c5b7b commit 02387b5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/media/pci/mantis/mantis_dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,11 @@ static inline int mantis_alloc_buffers(struct mantis_pci *mantis)

int mantis_dma_init(struct mantis_pci *mantis)
{
int err = 0;
int err;

dprintk(MANTIS_DEBUG, 1, "Mantis DMA init");
if (mantis_alloc_buffers(mantis) < 0) {
err = mantis_alloc_buffers(mantis);
if (err < 0) {
dprintk(MANTIS_ERROR, 1, "Error allocating DMA buffer");

/* Stop RISC Engine */
Expand Down

0 comments on commit 02387b5

Please sign in to comment.