There is no need to call spi_master_put() if spi_alloc_master()
failed, it should return -ENOMEM directly.

Signed-off-by: Peng Fan <fanp...@loongson.cn>
---
 drivers/spi/spi-atmel.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c
index 57ee8c3..6ed7abd 100644
--- a/drivers/spi/spi-atmel.c
+++ b/drivers/spi/spi-atmel.c
@@ -1546,10 +1546,9 @@ static int atmel_spi_probe(struct platform_device *pdev)
                return PTR_ERR(clk);
 
        /* setup spi core then atmel-specific driver state */
-       ret = -ENOMEM;
        master = spi_alloc_master(&pdev->dev, sizeof(*as));
        if (!master)
-               goto out_free;
+               return -ENOMEM;
 
        /* the spi->mode bits understood by this driver: */
        master->use_gpio_descriptors = true;
-- 
2.1.0

Reply via email to