ASoC: Intel: fix runtime pm imbalance on error
authorJunjie Mao <junjie.mao@enight.me>
Fri, 17 Jul 2015 02:29:00 +0000 (10:29 +0800)
committerMark Brown <broonie@kernel.org>
Fri, 14 Aug 2015 16:41:21 +0000 (17:41 +0100)
pm_runtime_get_sync() increments the runtime PM usage counter even the
call returns an error code. Thus a pairing decrement is needed on the
error handling path to keep the counter balanced.

Signed-off-by: Junjie Mao <junjie.mao@enight.me>
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/intel/atom/sst/sst_drv_interface.c

index 620da1d1b9e3ea4fbde293c3e98fae4c30708ac1..27a9653aa3d901529217937298b2f50808ad04c2 100644 (file)
@@ -152,6 +152,7 @@ static int sst_power_control(struct device *dev, bool state)
 
                dev_dbg(ctx->dev, "Enable: pm usage count: %d\n", usage_count);
                if (ret < 0) {
+                       pm_runtime_put_sync(dev);
                        dev_err(ctx->dev, "Runtime get failed with err: %d\n", ret);
                        return ret;
                }
@@ -204,8 +205,10 @@ static int sst_cdev_open(struct device *dev,
        struct intel_sst_drv *ctx = dev_get_drvdata(dev);
 
        retval = pm_runtime_get_sync(ctx->dev);
-       if (retval < 0)
+       if (retval < 0) {
+               pm_runtime_put_sync(ctx->dev);
                return retval;
+       }
 
        str_id = sst_get_stream(ctx, str_params);
        if (str_id > 0) {
@@ -672,8 +675,10 @@ static int sst_send_byte_stream(struct device *dev,
        if (NULL == bytes)
                return -EINVAL;
        ret_val = pm_runtime_get_sync(ctx->dev);
-       if (ret_val < 0)
+       if (ret_val < 0) {
+               pm_runtime_put_sync(ctx->dev);
                return ret_val;
+       }
 
        ret_val = sst_send_byte_stream_mrfld(ctx, bytes);
        sst_pm_runtime_put(ctx);
This page took 0.025788 seconds and 5 git commands to generate.