]> www.infradead.org Git - linux.git/commitdiff
spi: bcmbca-hsspi: Use devm_spi_alloc_host()
authorJinjie Ruan <ruanjinjie@huawei.com>
Mon, 26 Aug 2024 12:49:03 +0000 (20:49 +0800)
committerMark Brown <broonie@kernel.org>
Wed, 28 Aug 2024 19:39:08 +0000 (20:39 +0100)
Use devm_spi_alloc_host() so that there's no need to call
spi_controller_put() in the error path.

Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
Reviewed-by: William Zhang <william.zhang@broadcom.com>
Link: https://patch.msgid.link/20240826124903.3429235-3-ruanjinjie@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-bcmbca-hsspi.c

index f465daa473d063b4bc41ef7443dba8eef901dd72..d936104a41ece764795c35ce79a15c9cce311707 100644 (file)
@@ -480,7 +480,7 @@ static int bcmbca_hsspi_probe(struct platform_device *pdev)
                }
        }
 
-       host = spi_alloc_host(&pdev->dev, sizeof(*bs));
+       host = devm_spi_alloc_host(&pdev->dev, sizeof(*bs));
        if (!host) {
                ret = -ENOMEM;
                goto out_disable_pll_clk;
@@ -536,17 +536,17 @@ static int bcmbca_hsspi_probe(struct platform_device *pdev)
                ret = devm_request_irq(dev, irq, bcmbca_hsspi_interrupt, IRQF_SHARED,
                               pdev->name, bs);
                if (ret)
-                       goto out_put_host;
+                       goto out_disable_pll_clk;
        }
 
        ret = devm_pm_runtime_enable(&pdev->dev);
        if (ret)
-               goto out_put_host;
+               goto out_disable_pll_clk;
 
        ret = sysfs_create_group(&pdev->dev.kobj, &bcmbca_hsspi_group);
        if (ret) {
                dev_err(&pdev->dev, "couldn't register sysfs group\n");
-               goto out_put_host;
+               goto out_disable_pll_clk;
        }
 
        /* register and we are done */
@@ -560,8 +560,6 @@ static int bcmbca_hsspi_probe(struct platform_device *pdev)
 
 out_sysgroup_disable:
        sysfs_remove_group(&pdev->dev.kobj, &bcmbca_hsspi_group);
-out_put_host:
-       spi_controller_put(host);
 out_disable_pll_clk:
        clk_disable_unprepare(pll_clk);
 out_disable_clk: