Skip to contentSkip to conversation

i2c: tegra: Correct error path in probe

PATCH Applied Jon Hunter 3 participants 5 messages Jun 14, 2016 – Jul 5, 2016

Subsystems (3)
lore
Share & tools
lore

Jon Hunter

author maintainer
#0 lore raw

PATCH 1/1 i2c: tegra: Correct error path in probe

Commit 497fbe24987b ("i2c: tegra: enable multi master mode for tegra210") enables the Tegra I2C 'div_clk' for adapters using the multi-master mode during the device probe. Although the probe error path was updated to disable the clock on probe failure, there is one place after calling tegra_i2c_init() where the clock will not be disabled on failure. Correct the error path so that the 'div_clk' is disabled if calling tegra_i2c_init() fails.

Fixes 497fbe24987b ("i2c: tegra: enable multi master mode for tegra210")
---
 drivers/i2c/busses/i2c-tegra.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/busses/i2c-tegra.c +1 -1
index 445398c314a3..b126dbaa47e3 100644
@@ -912,7 +912,7 @@ static int tegra_i2c_probe(struct platform_device *pdev)
 	ret = tegra_i2c_init(i2c_dev);
 	if (ret) {
 		dev_err(&pdev->dev, "Failed to initialize i2c controller");
-		goto unprepare_div_clk;
+		goto disable_div_clk;
 	}
 
 	ret = devm_request_irq(&pdev->dev, i2c_dev->irq,
Signature · 1 line
2.1.4
author maintainer
#1 lore raw

Hi all,

Quoted 20 lines · Jon Hunter

Commit 497fbe24987b ("i2c: tegra: enable multi master mode for tegra210") enables the Tegra I2C 'div_clk' for adapters using the multi-master mode during the device probe. Although the probe error path was updated to disable the clock on probe failure, there is one place after calling tegra_i2c_init() where the clock will not be disabled on failure. Correct the error path so that the 'div_clk' is disabled if calling tegra_i2c_init() fails.

Fixes 497fbe24987b ("i2c: tegra: enable multi master mode for tegra210")
---
 drivers/i2c/busses/i2c-tegra.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/busses/i2c-tegra.c +0 -0
index 445398c314a3..b126dbaa47e3 100644

drivers/i2c/busses/i2c-tegra.c static int tegra_i2c_probe(struct platform_device *pdev) · line 918

Quoted 8 lines
drivers/i2c/busses/i2c-tegra.c +1 -1
@@ -912,7 +912,7 @@ static int tegra_i2c_probe(struct platform_device *pdev)
 	ret = tegra_i2c_init(i2c_dev);
 	if (ret) {
 		dev_err(&pdev->dev, "Failed to initialize i2c controller");
-		goto unprepare_div_clk;
+		goto disable_div_clk;
 	}
 
 	ret = devm_request_irq(&pdev->dev, i2c_dev->irq,

Any feedback on this?

Jon

Signature · 1 line
nvpublic
maintainer Acked-by
#2 lore raw
Quoted 11 lines · Jon Hunter

Hi all,

drivers/i2c/busses/i2c-tegra.c static int tegra_i2c_probe(struct platform_device *pdev) · line 917

Quoted 8 lines · Jon Hunter
drivers/i2c/busses/i2c-tegra.c +1 -1
@@ -912,7 +912,7 @@ static int tegra_i2c_probe(struct platform_device *pdev)
  	ret = tegra_i2c_init(i2c_dev);
  	if (ret) {
  		dev_err(&pdev->dev, "Failed to initialize i2c controller");
-		goto unprepare_div_clk;
+		goto disable_div_clk;
  	}
 

Yes, this looks correct.

author maintainer
#3 lore raw

Wolfram,

Quoted 17 lines · Laxman Dewangan
Quoted 12 lines · Jon Hunter

Hi all,

drivers/i2c/busses/i2c-tegra.c static int tegra_i2c_probe(struct platform_device · line 918

Quoted 9 lines · Jon Hunter
drivers/i2c/busses/i2c-tegra.c +1 -1
@@ -912,7 +912,7 @@ static int tegra_i2c_probe(struct platform_device
 *pdev)
      ret = tegra_i2c_init(i2c_dev);
      if (ret) {
          dev_err(&pdev->dev, "Failed to initialize i2c controller");
-        goto unprepare_div_clk;
+        goto disable_div_clk;
      }
 

Yes, this looks correct.

Quoted 1 line

Can you pick this one up?

Cheers
Jon

Signature · 1 line
nvpublic
Applied
#4 lore raw
In reply to Jon Hunter
Quoted 11 lines · Jon Hunter

Commit 497fbe24987b ("i2c: tegra: enable multi master mode for tegra210") enables the Tegra I2C 'div_clk' for adapters using the multi-master mode during the device probe. Although the probe error path was updated to disable the clock on probe failure, there is one place after calling tegra_i2c_init() where the clock will not be disabled on failure. Correct the error path so that the 'div_clk' is disabled if calling tegra_i2c_init() fails.

Fixes 497fbe24987b ("i2c: tegra: enable multi master mode for tegra210")

Applied to for-current, thanks!