Skip to contentSkip to conversation

FAILED: patch "[PATCH] spi: npcm-fiu: Disable clock in probe error path" failed to apply to 5.4-stable tree

PATCH [email protected] 2 participants 3 messages Dec 28, 2020 – Jan 21, 2021

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

The patch below does not apply to the 5.4-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From 234266a5168bbe8220d263e3aa7aa80cf921c483 Mon Sep 17 00:00:00 2001
From: Lukas Wunner <[email protected]>
Date: Mon, 7 Dec 2020 09:17:16 +0100
Subject: [PATCH] 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.

drivers/spi/spi-npcm-fiu.c +6 -2
index 1cb9329de945..b62471ab6d7f 100644
@@ -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)
#1 lore raw

Hi Greg,

Quoted 5 lines · On Mon, Dec 28, 2020 at 12:00:27PM +0100, [email protected] wrote:

The patch below does not apply to the 5.4-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

Here is the backport along with 4c3a14fbc05a ("spi: npcm-fiu: simplify the return expression of npcm_fiu_probe()") which makes backport easier.

--
Regards
Sudip

From cefb8d3e297579898a170ae99f9bad4c0c5342a4 Mon Sep 17 00:00:00 2001
From: Qinglang Miao <[email protected]>
Date: Mon, 21 Sep 2020 21:11:06 +0800
Subject: [PATCH 1/2] spi: npcm-fiu: simplify the return expression of
npcm_fiu_probe()

commit 4c3a14fbc05a09fc369fb68a86cdbf6f441a29f2 upstream

Simplify the return expression.

---
 drivers/spi/spi-npcm-fiu.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/spi/spi-npcm-fiu.c +1 -6
index 5ed7c9e017fb..561c68329133 100644
@@ -677,7 +677,6 @@ static int npcm_fiu_probe(struct platform_device *pdev)
 	struct npcm_fiu_spi *fiu;
 	void __iomem *regbase;
 	struct resource *res;
-	int ret;
 	int id;
 
 	ctrl = devm_spi_alloc_master(dev, sizeof(*fiu));
@@ -736,11 +735,7 @@ static int npcm_fiu_probe(struct platform_device *pdev)
 	ctrl->num_chipselect = fiu->info->max_cs;
 	ctrl->dev.of_node = dev->of_node;
 
-	ret = devm_spi_register_master(dev, ctrl);
-	if (ret)
-		return ret;
-
-	return 0;
+	return devm_spi_register_master(dev, ctrl);
 }
 
 static int npcm_fiu_remove(struct platform_device *pdev)
Signature · 1 line
2.11.0

From 02b79219e662710c4ec8fcc4047cd9da8ce3c281 Mon Sep 17 00:00:00 2001
From: Lukas Wunner <[email protected]>
Date: Mon, 7 Dec 2020 09:17:16 +0100
Subject: [PATCH 2/2] spi: npcm-fiu: Disable clock in probe error path

commit 234266a5168bbe8220d263e3aa7aa80cf921c483 upstream

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.

---
 drivers/spi/spi-npcm-fiu.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/spi/spi-npcm-fiu.c +6 -2
index 561c68329133..1e770d673905 100644
@@ -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)
Signature · 1 line
2.11.0
author maintainer
#2 lore raw
Quoted 11 lines · Sudip Mukherjee

Hi Greg,

Quoted 5 lines · On Mon, Dec 28, 2020 at 12:00:27PM +0100, [email protected] wrote:

The patch below does not apply to the 5.4-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

Here is the backport along with 4c3a14fbc05a ("spi: npcm-fiu: simplify the return expression of npcm_fiu_probe()") which makes backport easier.

Both now queud up, thanks.

greg k-h