Commit cb60e96
committed
opp: Prevent memory leak in dev_pm_opp_attach_genpd()
If dev_pm_opp_attach_genpd() is called multiple times (once for each CPU
sharing the table), then it would result in unwanted behavior like
memory leak, attaching the domain multiple times, etc.
Handle that by checking and returning earlier if the domains are already
attached. Now that dev_pm_opp_detach_genpd() can get called multiple
times as well, we need to protect that too.
Note that the virtual device pointers aren't returned in this case, as
they may become unavailable to some callers during the middle of the
operation.
Reported-by: Stephan Gerhold <stephan@gerhold.net>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>1 parent 7162fc2 commit cb60e96
1 file changed
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1960 | 1960 | | |
1961 | 1961 | | |
1962 | 1962 | | |
| 1963 | + | |
| 1964 | + | |
| 1965 | + | |
1963 | 1966 | | |
1964 | 1967 | | |
1965 | 1968 | | |
| |||
2006 | 2009 | | |
2007 | 2010 | | |
2008 | 2011 | | |
| 2012 | + | |
| 2013 | + | |
| 2014 | + | |
2009 | 2015 | | |
2010 | 2016 | | |
2011 | 2017 | | |
| |||
0 commit comments