@@ -448,7 +448,6 @@ static void uwire_off(struct uwire_spi *uwire)
{
uwire_write_reg(UWIRE_SR3, 0);
clk_disable_unprepare(uwire->ck);
- spi_master_put(uwire->bitbang.master);
}
static int uwire_probe(struct platform_device *pdev)
@@ -457,7 +456,7 @@ static int uwire_probe(struct platform_device *pdev)
struct uwire_spi *uwire;
int status;
- master = spi_alloc_master(&pdev->dev, sizeof(*uwire));
+ master = devm_spi_alloc_master(&pdev->dev, sizeof(*uwire));
if (!master)
return -ENODEV;
@@ -466,7 +465,6 @@ static int uwire_probe(struct platform_device *pdev)
uwire_base = devm_ioremap(&pdev->dev, UWIRE_BASE_PHYS, UWIRE_IO_SIZE);
if (!uwire_base) {
dev_dbg(&pdev->dev, "can't ioremap UWIRE\n");
- spi_master_put(master);
return -ENOMEM;
}
@@ -476,7 +474,6 @@ static int uwire_probe(struct platform_device *pdev)
if (IS_ERR(uwire->ck)) {
status = PTR_ERR(uwire->ck);
dev_dbg(&pdev->dev, "no functional clock?\n");
- spi_master_put(master);
return status;
}
clk_prepare_enable(uwire->ck);
@@ -518,6 +515,7 @@ static int uwire_remove(struct platform_device *pdev)
spi_bitbang_stop(&uwire->bitbang);
uwire_off(uwire);
+ spi_master_put(uwire->bitbang.master);
return 0;
}
Switch to use devm_spi_alloc_master() to simpify error path. Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> --- drivers/spi/spi-omap-uwire.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)