lkml.org 
[lkml]   [2020]   [Jun]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] Input: bma150: fix ref count leak in bma150_open
On Sun, Jun 14, 2020 at 8:58 AM Navid Emamdoost
<navid.emamdoost@gmail.com> wrote:
>
> 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.

...

> 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?

...

> + pm_runtime_put(&bma150->client->dev);

Slightly better to use _put_noidle(). (More consistency with error path)

--
With Best Regards,
Andy Shevchenko

\
 
 \ /
  Last update: 2020-06-14 11:29    [W:0.053 / U:0.412 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site