mirror of
https://github.com/torvalds/linux.git
synced 2026-07-28 10:09:10 +02:00
media: dm1105: fix missing error check for dma_alloc_coherent
The return value of dm1105_dma_map(), which handles DMA memory allocation, is ignored in dm1105_hw_init(). If dma_alloc_coherent() fails, the driver will proceed using a NULL pointer for DMA transfers, leading to a kernel oops or invalid hardware access. Fix this by checking the return value and propagating -ENOMEM on failure. Signed-off-by: Zhaoyang Yu <2426767509@qq.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
This commit is contained in:
parent
e424693044
commit
3eaac9e02d
|
|
@ -768,6 +768,8 @@ static void dm1105_ir_exit(struct dm1105_dev *dm1105)
|
|||
|
||||
static int dm1105_hw_init(struct dm1105_dev *dev)
|
||||
{
|
||||
int ret;
|
||||
|
||||
dm1105_disable_irqs(dev);
|
||||
|
||||
dm_writeb(DM1105_HOST_CTR, 0);
|
||||
|
|
@ -778,7 +780,10 @@ static int dm1105_hw_init(struct dm1105_dev *dev)
|
|||
dm_writew(DM1105_TSCTR, 0xc10a);
|
||||
|
||||
/* map DMA and set address */
|
||||
dm1105_dma_map(dev);
|
||||
ret = dm1105_dma_map(dev);
|
||||
if (ret)
|
||||
return -ENOMEM;
|
||||
|
||||
dm1105_set_dma_addr(dev);
|
||||
/* big buffer */
|
||||
dm_writel(DM1105_RLEN, 5 * DM1105_DMA_BYTES);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user