Re: [PATCH] Input: bma150: fix ref count leak in bma150_open
From: Navid Emamdoost <hidden>
Date: 2020-06-15 06:36:43
Also in:
lkml
From: Navid Emamdoost <hidden>
Date: 2020-06-15 06:36:43
Also in:
lkml
On Sun, Jun 14, 2020 at 4:27 AM Andy Shevchenko [off-list ref] wrote:
On Sun, Jun 14, 2020 at 8:58 AM Navid Emamdoost [off-list ref] wrote:quoted
in bma150_open, pm_runtime_get_sync is called which increments the counter even in case of failure, leading to incorrect ref count. In case of failure, decrement the ref count before returning....quoted
error = pm_runtime_get_sync(&bma150->client->dev); if (error < 0 && error != -ENOSYS) - return error; + goto out;So, what will happen in case of -ENOSYS?
I'm not sure!
...quoted
+ pm_runtime_put(&bma150->client->dev);Slightly better to use _put_noidle(). (More consistency with error path)
v2 is sent.
-- With Best Regards, Andy Shevchenko
-- Navid.