Re: [PATCH v5 26/36] i2c: tegra: Factor out hardware initialization into separate function

Andy Shevchenko
2020-09-07T08:25:49Z

On Sun, Sep 6, 2020 at 9:52 PM Dmitry Osipenko <digetx@gmail.com> wrote:
>
> Factor out hardware initialization into a separate function from the probe
> function. The only place where runtime PM needs to be resumed during probe
> is the place of hardware initialization, hence it makes sense to factor
> out it in order to have a bit cleaner error handling in tegra_i2c_probe().

...

> +static int tegra_i2c_init_hardware(struct tegra_i2c_dev *i2c_dev)
> +{
> + int ret;
> +
> + ret = pm_runtime_get_sync(i2c_dev->dev);
> + if (ret < 0) {
> + dev_err(i2c_dev->dev, "runtime resume failed: %d\n", ret);

refcount leak.

> + return ret;
> + }

--
With Best Regards,
Andy Shevchenko