lkml.org 
[lkml]   [2020]   [Jun]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    SubjectRe: [RFC PATCH v2 04/18] i2c: tegra: Fix the error path in tegra_i2c_runtime_resume
    From
    Date
    17.06.2020 04:41, Sowjanya Komatineni пишет:
    > tegra_i2c_runtime_resume does not disable prior enabled clocks
    > properly.
    >
    > This patch fixes it.
    >
    > Signed-off-by: Sowjanya Komatineni <skomatineni@nvidia.com>
    > ---
    > drivers/i2c/busses/i2c-tegra.c | 11 ++++++++---
    > 1 file changed, 8 insertions(+), 3 deletions(-)
    >
    > diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
    > index 3be1018..1b459ca 100644
    > --- a/drivers/i2c/busses/i2c-tegra.c
    > +++ b/drivers/i2c/busses/i2c-tegra.c
    > @@ -668,7 +668,7 @@ static int __maybe_unused tegra_i2c_runtime_resume(struct device *dev)
    > ret = clk_enable(i2c_dev->slow_clk);
    > if (ret < 0) {
    > dev_err(dev, "failed to enable slow clock: %d\n", ret);
    > - return ret;
    > + goto disable_fast_clk;
    > }
    > }
    >
    > @@ -676,11 +676,16 @@ static int __maybe_unused tegra_i2c_runtime_resume(struct device *dev)
    > if (ret < 0) {
    > dev_err(i2c_dev->dev,
    > "Enabling div clk failed, err %d\n", ret);
    > - clk_disable(i2c_dev->fast_clk);
    > - return ret;
    > + goto disable_slow_clk;
    > }
    >
    > return 0;
    > +
    > +disable_slow_clk:
    > + clk_disable(i2c_dev->slow_clk);
    > +disable_fast_clk:
    > + clk_disable(i2c_dev->fast_clk);
    > + return ret;
    > }
    >
    > static int __maybe_unused tegra_i2c_runtime_suspend(struct device *dev)
    >

    This looks good to me. Could you please add an additional patch to
    remove all the other conditions of the clk enable/disable? The current
    code was already inconsistent because in most cases there are
    conditions, but not in all cases.

    \
     
     \ /
      Last update: 2020-06-17 06:53    [W:2.789 / U:0.024 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site