Merge branch 'for-5.4' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie...
[sfrench/cifs-2.6.git] / drivers / spi / spi-gpio.c
index 1d3e23ec20a61fd926d29585fbd29d4d9d9d1593..7ceb0ba27b755ce2b7250798b7b37c33c9d60b92 100644 (file)
@@ -362,19 +362,18 @@ static int spi_gpio_probe(struct platform_device *pdev)
        struct spi_gpio                 *spi_gpio;
        struct device                   *dev = &pdev->dev;
        struct spi_bitbang              *bb;
-       const struct of_device_id       *of_id;
-
-       of_id = of_match_device(spi_gpio_dt_ids, &pdev->dev);
 
        master = spi_alloc_master(dev, sizeof(*spi_gpio));
        if (!master)
                return -ENOMEM;
 
        status = devm_add_action_or_reset(&pdev->dev, spi_gpio_put, master);
-       if (status)
+       if (status) {
+               spi_master_put(master);
                return status;
+       }
 
-       if (of_id)
+       if (pdev->dev.of_node)
                status = spi_gpio_probe_dt(pdev, master);
        else
                status = spi_gpio_probe_pdata(pdev, master);