Skip to content

Commit deb269e

Browse files
Jinjie Ruanbroonie
authored andcommitted
spi: bcmbca-hsspi: Use devm_spi_alloc_host()
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 <[email protected]> Reviewed-by: William Zhang <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 4439a2e commit deb269e

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

drivers/spi/spi-bcmbca-hsspi.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ static int bcmbca_hsspi_probe(struct platform_device *pdev)
480480
}
481481
}
482482

483-
host = spi_alloc_host(&pdev->dev, sizeof(*bs));
483+
host = devm_spi_alloc_host(&pdev->dev, sizeof(*bs));
484484
if (!host) {
485485
ret = -ENOMEM;
486486
goto out_disable_pll_clk;
@@ -536,17 +536,17 @@ static int bcmbca_hsspi_probe(struct platform_device *pdev)
536536
ret = devm_request_irq(dev, irq, bcmbca_hsspi_interrupt, IRQF_SHARED,
537537
pdev->name, bs);
538538
if (ret)
539-
goto out_put_host;
539+
goto out_disable_pll_clk;
540540
}
541541

542542
ret = devm_pm_runtime_enable(&pdev->dev);
543543
if (ret)
544-
goto out_put_host;
544+
goto out_disable_pll_clk;
545545

546546
ret = sysfs_create_group(&pdev->dev.kobj, &bcmbca_hsspi_group);
547547
if (ret) {
548548
dev_err(&pdev->dev, "couldn't register sysfs group\n");
549-
goto out_put_host;
549+
goto out_disable_pll_clk;
550550
}
551551

552552
/* register and we are done */
@@ -560,8 +560,6 @@ static int bcmbca_hsspi_probe(struct platform_device *pdev)
560560

561561
out_sysgroup_disable:
562562
sysfs_remove_group(&pdev->dev.kobj, &bcmbca_hsspi_group);
563-
out_put_host:
564-
spi_controller_put(host);
565563
out_disable_pll_clk:
566564
clk_disable_unprepare(pll_clk);
567565
out_disable_clk:

0 commit comments

Comments
 (0)