Commit ca323b2c authored by Zhang Qilong's avatar Zhang Qilong Committed by Herbert Xu

crypto: omap-sham - Fix PM reference leak in omap sham ops

pm_runtime_get_sync will increment pm usage counter
even it failed. Forgetting to putting operation will
result in reference leak here. We fix it by replacing
it with pm_runtime_resume_and_get to keep usage counter
balanced.

Fixes: 604c3103 ("crypto: omap-sham - Check for return value from pm_runtime_get_sync")
Signed-off-by: default avatarZhang Qilong <zhangqilong3@huawei.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent d950cd1b
...@@ -372,7 +372,7 @@ static int omap_sham_hw_init(struct omap_sham_dev *dd) ...@@ -372,7 +372,7 @@ static int omap_sham_hw_init(struct omap_sham_dev *dd)
{ {
int err; int err;
err = pm_runtime_get_sync(dd->dev); err = pm_runtime_resume_and_get(dd->dev);
if (err < 0) { if (err < 0) {
dev_err(dd->dev, "failed to get sync: %d\n", err); dev_err(dd->dev, "failed to get sync: %d\n", err);
return err; return err;
...@@ -2244,7 +2244,7 @@ static int omap_sham_suspend(struct device *dev) ...@@ -2244,7 +2244,7 @@ static int omap_sham_suspend(struct device *dev)
static int omap_sham_resume(struct device *dev) static int omap_sham_resume(struct device *dev)
{ {
int err = pm_runtime_get_sync(dev); int err = pm_runtime_resume_and_get(dev);
if (err < 0) { if (err < 0) {
dev_err(dev, "failed to get sync: %d\n", err); dev_err(dev, "failed to get sync: %d\n", err);
return err; return err;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment