lkml.org 
[lkml]   [2021]   [Apr]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH -next] i2c: imx: Fix PM reference leak in i2c_imx_reg_slave()
On Thu, Apr 08, 2021 at 07:06:38PM +0800, Ye Weihua wrote:
> The PM reference count is not expected to be incremented on return in
> these functions.
>
> However, pm_runtime_get_sync() will increment the PM reference count
> even on failure. forgetting to put the reference again will result in
> a leak.
>
> Replace it with pm_runtime_resume_and_get() to keep the usage counter
> balanced.
>
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Ye Weihua <yeweihua4@huawei.com>

After rebasing, only one hunk was left:

> @@ -801,7 +801,7 @@ static int i2c_imx_reg_slave(struct i2c_client *client)
> i2c_imx->last_slave_event = I2C_SLAVE_STOP;
>
> /* Resume */
> - ret = pm_runtime_get_sync(i2c_imx->adapter.dev.parent);
> + ret = pm_runtime_resume_and_get(i2c_imx->adapter.dev.parent);
> if (ret < 0) {
> dev_err(&i2c_imx->adapter.dev, "failed to resume i2c controller");
> return ret;

I applied this to for-next, thanks!

[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2021-04-14 10:05    [W:0.038 / U:0.448 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site