Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

i2c: tegra: disable clock before returning error

Disable clock before returning error in tegra_i2c_init() as its leaves
i2c clock ON in case of error and never turns off again as it will have
unbalanced clock enable/disable

Signed-off-by: Shardar Shariff Md <smohammed@nvidia.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>

authored by

Shardar Shariff Md and committed by
Wolfram Sang
21e9efd9 3f30e40b

+4 -3
+4 -3
drivers/i2c/busses/i2c-tegra.c
··· 483 483 if (time_after(jiffies, timeout)) { 484 484 dev_warn(i2c_dev->dev, 485 485 "timeout waiting for config load\n"); 486 - return -ETIMEDOUT; 486 + err = -ETIMEDOUT; 487 + goto err; 487 488 } 488 489 msleep(1); 489 490 } 490 491 } 491 - 492 - tegra_i2c_clock_disable(i2c_dev); 493 492 494 493 if (i2c_dev->irq_disabled) { 495 494 i2c_dev->irq_disabled = 0; 496 495 enable_irq(i2c_dev->irq); 497 496 } 498 497 498 + err: 499 + tegra_i2c_clock_disable(i2c_dev); 499 500 return err; 500 501 } 501 502