forked from Minki/linux
spi-topcliff-pch: Fix probing when DMA mode is used
If during registering SPI master due to SPI device probing a SPI transfer is issued the DMA buffers are not allocated yet. This fixes the following oops: pch_spi 0000:02:0c.1: enabling device (0000 -> 0002) pch_spi 0000:02:0c.1: master is unqueued, this is deprecated BUG: unable to handle kernel NULL pointer dereference at (null) IP: [<c125aa05>] pch_spi_handle_dma+0x15c/0x6f4 [...] Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com> Signed-off-by: Mark Brown <broonie@linaro.org>
This commit is contained in:
parent
7611c7a561
commit
7995d74ab2
@ -1452,6 +1452,11 @@ static int pch_spi_pd_probe(struct platform_device *plat_dev)
|
||||
|
||||
pch_spi_set_master_mode(master);
|
||||
|
||||
if (use_dma) {
|
||||
dev_info(&plat_dev->dev, "Use DMA for data transfers\n");
|
||||
pch_alloc_dma_buf(board_dat, data);
|
||||
}
|
||||
|
||||
ret = spi_register_master(master);
|
||||
if (ret != 0) {
|
||||
dev_err(&plat_dev->dev,
|
||||
@ -1459,14 +1464,10 @@ static int pch_spi_pd_probe(struct platform_device *plat_dev)
|
||||
goto err_spi_register_master;
|
||||
}
|
||||
|
||||
if (use_dma) {
|
||||
dev_info(&plat_dev->dev, "Use DMA for data transfers\n");
|
||||
pch_alloc_dma_buf(board_dat, data);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
err_spi_register_master:
|
||||
pch_free_dma_buf(board_dat, data);
|
||||
free_irq(board_dat->pdev->irq, data);
|
||||
err_request_irq:
|
||||
pch_spi_free_resources(board_dat, data);
|
||||
|
Loading…
Reference in New Issue
Block a user