Unverified Commit 234266a5 authored by Lukas Wunner's avatar Lukas Wunner Committed by Mark Brown
Browse files

spi: npcm-fiu: Disable clock in probe error path



If the call to devm_spi_register_master() fails on probe of the NPCM FIU
SPI driver, the clock "fiu->clk" is erroneously not unprepared and
disabled.  Fix it.

Fixes: ace55c41 ("spi: npcm-fiu: add NPCM FIU controller driver")
Signed-off-by: default avatarLukas Wunner <lukas@wunner.de>
Cc: <stable@vger.kernel.org> # v5.4+
Cc: Tomer Maimon <tmaimon77@gmail.com>
Link: https://lore.kernel.org/r/9ae62f4e1cfe542bec57ac2743e6fca9f9548f55.1607286887.git.lukas@wunner.de


Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 236924ee
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -677,7 +677,7 @@ static int npcm_fiu_probe(struct platform_device *pdev)
	struct npcm_fiu_spi *fiu;
	void __iomem *regbase;
	struct resource *res;
	int id;
	int id, ret;

	ctrl = devm_spi_alloc_master(dev, sizeof(*fiu));
	if (!ctrl)
@@ -735,7 +735,11 @@ static int npcm_fiu_probe(struct platform_device *pdev)
	ctrl->num_chipselect = fiu->info->max_cs;
	ctrl->dev.of_node = dev->of_node;

	return devm_spi_register_master(dev, ctrl);
	ret = devm_spi_register_master(dev, ctrl);
	if (ret)
		clk_disable_unprepare(fiu->clk);

	return ret;
}

static int npcm_fiu_remove(struct platform_device *pdev)