diff options
author | Fabio Estevam <fabio.estevam@freescale.com> | 2015-08-10 13:11:41 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2015-08-19 06:04:55 -0400 |
commit | 02387b5f25bdba668c7fe2618697bae24f973667 (patch) | |
tree | b1eaac45b20e76cf8d1b0714df25a1f48f91ae43 | |
parent | 72c5b7b24f3800bf8b1b1c78511c6da09d33c590 (diff) |
[media] mantis: Fix error handling in mantis_dma_init()
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>
-rw-r--r-- | drivers/media/pci/mantis/mantis_dma.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/media/pci/mantis/mantis_dma.c b/drivers/media/pci/mantis/mantis_dma.c index 1d59c7e039f7..87990ece5848 100644 --- a/drivers/media/pci/mantis/mantis_dma.c +++ b/drivers/media/pci/mantis/mantis_dma.c | |||
@@ -130,10 +130,11 @@ err: | |||
130 | 130 | ||
131 | int mantis_dma_init(struct mantis_pci *mantis) | 131 | int mantis_dma_init(struct mantis_pci *mantis) |
132 | { | 132 | { |
133 | int err = 0; | 133 | int err; |
134 | 134 | ||
135 | dprintk(MANTIS_DEBUG, 1, "Mantis DMA init"); | 135 | dprintk(MANTIS_DEBUG, 1, "Mantis DMA init"); |
136 | if (mantis_alloc_buffers(mantis) < 0) { | 136 | err = mantis_alloc_buffers(mantis); |
137 | if (err < 0) { | ||
137 | dprintk(MANTIS_ERROR, 1, "Error allocating DMA buffer"); | 138 | dprintk(MANTIS_ERROR, 1, "Error allocating DMA buffer"); |
138 | 139 | ||
139 | /* Stop RISC Engine */ | 140 | /* Stop RISC Engine */ |