crypto: hisilicon/qm - fix missing put dfx access
authorWeili Qian <qianweili@huawei.com>
Sat, 27 Aug 2022 10:27:37 +0000 (18:27 +0800)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 2 Sep 2022 10:38:06 +0000 (18:38 +0800)
In function qm_cmd_write(), if function returns from
branch 'atomic_read(&qm->status.flags) == QM_STOP',
the got dfx access is forgotten to put.

Fixes: 607c191b371d ("crypto: hisilicon - support runtime PM for accelerator device")
Signed-off-by: Weili Qian <qianweili@huawei.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/hisilicon/qm.c

index 1c661c8..fd9fb15 100644 (file)
@@ -2216,8 +2216,10 @@ static ssize_t qm_cmd_write(struct file *filp, const char __user *buffer,
                return ret;
 
        /* Judge if the instance is being reset. */
-       if (unlikely(atomic_read(&qm->status.flags) == QM_STOP))
-               return 0;
+       if (unlikely(atomic_read(&qm->status.flags) == QM_STOP)) {
+               ret = 0;
+               goto put_dfx_access;
+       }
 
        if (count > QM_DBG_WRITE_LEN) {
                ret = -ENOSPC;