spi: davinci: Initialize dspi->done before any possible use of it
authorMichele Dionisio <michele.dionisio@gmail.com>
Tue, 12 Dec 2017 10:36:59 +0000 (11:36 +0100)
committerMark Brown <broonie@kernel.org>
Tue, 12 Dec 2017 10:51:52 +0000 (10:51 +0000)
On SOC with multiple cpu (like omal l138) it is possible that spi
periferic is already initialized when this module is loaded and so
it is possible to recieve interrupt when the modules is not fully
initialized.

this patch initialize dspi->done before refister the interrupt
handler that use it

Signed-off-by: Michele Dionisio <michele.dionisio@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-davinci.c

index 6ddb6ef1fda4ff0900b97d7b87942bbe9935475d..60d59b003aa4339752c97e5c27ba11d15f4d4390 100644 (file)
@@ -945,6 +945,8 @@ static int davinci_spi_probe(struct platform_device *pdev)
                goto free_master;
        }
 
+       init_completion(&dspi->done);
+
        ret = platform_get_irq(pdev, 0);
        if (ret == 0)
                ret = -EINVAL;
@@ -1021,8 +1023,6 @@ static int davinci_spi_probe(struct platform_device *pdev)
        dspi->get_rx = davinci_spi_rx_buf_u8;
        dspi->get_tx = davinci_spi_tx_buf_u8;
 
-       init_completion(&dspi->done);
-
        /* Reset In/OUT SPI module */
        iowrite32(0, dspi->base + SPIGCR0);
        udelay(100);