dmaengine: dma-jz4780: Return error if not probed from DT
authorPaul Cercueil <paul@crapouillou.net>
Wed, 29 Aug 2018 21:32:44 +0000 (23:32 +0200)
committerVinod Koul <vkoul@kernel.org>
Tue, 11 Sep 2018 07:29:25 +0000 (12:59 +0530)
The driver calls clk_get() with the clock name set to NULL, which means
that the driver could only work when probed from devicetree. From now
on, we explicitly require the driver to be probed from devicetree.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Tested-by: Mathieu Malaterre <malat@debian.org>
Signed-off-by: Vinod Koul <vkoul@kernel.org>
drivers/dma/dma-jz4780.c

index 85820a2d69d48a104ca8063e796f8870e3daef2c..987899610b46113449add169ae60657e06e15fb7 100644 (file)
@@ -761,6 +761,11 @@ static int jz4780_dma_probe(struct platform_device *pdev)
        struct resource *res;
        int i, ret;
 
+       if (!dev->of_node) {
+               dev_err(dev, "This driver must be probed from devicetree\n");
+               return -EINVAL;
+       }
+
        jzdma = devm_kzalloc(dev, sizeof(*jzdma), GFP_KERNEL);
        if (!jzdma)
                return -ENOMEM;