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

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux

Pull i2c fixes from Wolfram Sang:
"Two runtime PM fixes and one leak fix"

* 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux:
i2c: iop3xx: Fix memory leak in probe error path
i2c: tegra: Properly disable runtime PM on driver's probe error
i2c: tegra: Fix suspending in active runtime PM state

+36 -14
+8 -4
drivers/i2c/busses/i2c-iop3xx.c
··· 433 433 adapter_data->gpio_scl = devm_gpiod_get_optional(&pdev->dev, 434 434 "scl", 435 435 GPIOD_ASIS); 436 - if (IS_ERR(adapter_data->gpio_scl)) 437 - return PTR_ERR(adapter_data->gpio_scl); 436 + if (IS_ERR(adapter_data->gpio_scl)) { 437 + ret = PTR_ERR(adapter_data->gpio_scl); 438 + goto free_both; 439 + } 438 440 adapter_data->gpio_sda = devm_gpiod_get_optional(&pdev->dev, 439 441 "sda", 440 442 GPIOD_ASIS); 441 - if (IS_ERR(adapter_data->gpio_sda)) 442 - return PTR_ERR(adapter_data->gpio_sda); 443 + if (IS_ERR(adapter_data->gpio_sda)) { 444 + ret = PTR_ERR(adapter_data->gpio_sda); 445 + goto free_both; 446 + } 443 447 444 448 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 445 449 if (!res) {
+28 -10
drivers/i2c/busses/i2c-tegra.c
··· 1608 1608 } 1609 1609 1610 1610 pm_runtime_enable(&pdev->dev); 1611 - if (!pm_runtime_enabled(&pdev->dev)) 1611 + if (!pm_runtime_enabled(&pdev->dev)) { 1612 1612 ret = tegra_i2c_runtime_resume(&pdev->dev); 1613 - else 1613 + if (ret < 0) { 1614 + dev_err(&pdev->dev, "runtime resume failed\n"); 1615 + goto unprepare_div_clk; 1616 + } 1617 + } else { 1614 1618 ret = pm_runtime_get_sync(i2c_dev->dev); 1615 - 1616 - if (ret < 0) { 1617 - dev_err(&pdev->dev, "runtime resume failed\n"); 1618 - goto unprepare_div_clk; 1619 + if (ret < 0) { 1620 + dev_err(&pdev->dev, "runtime resume failed\n"); 1621 + goto disable_rpm; 1622 + } 1619 1623 } 1620 1624 1621 1625 if (i2c_dev->is_multimaster_mode) { ··· 1627 1623 if (ret < 0) { 1628 1624 dev_err(i2c_dev->dev, "div_clk enable failed %d\n", 1629 1625 ret); 1630 - goto disable_rpm; 1626 + goto put_rpm; 1631 1627 } 1632 1628 } 1633 1629 ··· 1675 1671 if (i2c_dev->is_multimaster_mode) 1676 1672 clk_disable(i2c_dev->div_clk); 1677 1673 1678 - disable_rpm: 1679 - pm_runtime_disable(&pdev->dev); 1680 - if (!pm_runtime_status_suspended(&pdev->dev)) 1674 + put_rpm: 1675 + if (pm_runtime_enabled(&pdev->dev)) 1676 + pm_runtime_put_sync(&pdev->dev); 1677 + else 1681 1678 tegra_i2c_runtime_suspend(&pdev->dev); 1679 + 1680 + disable_rpm: 1681 + if (pm_runtime_enabled(&pdev->dev)) 1682 + pm_runtime_disable(&pdev->dev); 1682 1683 1683 1684 unprepare_div_clk: 1684 1685 clk_unprepare(i2c_dev->div_clk); ··· 1719 1710 static int __maybe_unused tegra_i2c_suspend(struct device *dev) 1720 1711 { 1721 1712 struct tegra_i2c_dev *i2c_dev = dev_get_drvdata(dev); 1713 + int err; 1722 1714 1723 1715 i2c_mark_adapter_suspended(&i2c_dev->adapter); 1716 + 1717 + err = pm_runtime_force_suspend(dev); 1718 + if (err < 0) 1719 + return err; 1724 1720 1725 1721 return 0; 1726 1722 } ··· 1745 1731 1746 1732 err = tegra_i2c_runtime_suspend(dev); 1747 1733 if (err) 1734 + return err; 1735 + 1736 + err = pm_runtime_force_resume(dev); 1737 + if (err < 0) 1748 1738 return err; 1749 1739 1750 1740 i2c_mark_adapter_resumed(&i2c_dev->adapter);