Skip to content

Commit

Permalink
spi: mt7621: Disable clock in probe error path
Browse files Browse the repository at this point in the history
commit 24f7033 upstream.

Commit 702b15c ("spi: mt7621: fix missing clk_disable_unprepare()
on error in mt7621_spi_probe") sought to disable the SYS clock on probe
errors, but only did so for 2 of 3 potentially failing calls:  The clock
needs to be disabled on failure of devm_spi_register_controller() as
well.

Moreover, the commit purports to fix a bug in commit cbd66c6 ("spi:
mt7621: Move SPI driver out of staging") but in reality the bug has
existed since the driver was first introduced.

Fixes: 1ab7f2a ("staging: mt7621-spi: add mt7621 support")
Signed-off-by: Lukas Wunner <lukas@wunner.de>
Cc: <stable@vger.kernel.org> # v4.17+: 702b15c: spi: mt7621: fix missing clk_disable_unprepare() on error in mt7621_spi_probe
Cc: <stable@vger.kernel.org> # v4.17+
Cc: Qinglang Miao <miaoqinglang@huawei.com>
Link: https://lore.kernel.org/r/36ad42760087952fb7c10aae7d2628547c26a7ec.1607286887.git.lukas@wunner.de
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
l1k authored and gregkh committed Dec 30, 2020
1 parent cad1895 commit 0818aab
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion drivers/spi/spi-mt7621.c
Expand Up @@ -382,7 +382,11 @@ static int mt7621_spi_probe(struct platform_device *pdev)
return ret;
}

return devm_spi_register_controller(&pdev->dev, master);
ret = devm_spi_register_controller(&pdev->dev, master);
if (ret)
clk_disable_unprepare(clk);

return ret;
}

static int mt7621_spi_remove(struct platform_device *pdev)
Expand Down

0 comments on commit 0818aab

Please sign in to comment.