crypto: ccp - Change a message to reflect status instead of failure
authorHook, Gary <Gary.Hook@amd.com>
Mon, 21 Oct 2019 13:44:37 +0000 (13:44 +0000)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 25 Oct 2019 15:09:59 +0000 (02:09 +1100)
If an AMD BIOS makes zero CCP queues available to the driver, the
device is unavailable and therefore can't be activated. When this
happens, report the status but don't report a (non-existent)
failure. The CCP will be unactivated.

Signed-off-by: Gary R Hook <gary.hook@amd.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/ccp/ccp-dev-v5.c
drivers/crypto/ccp/ccp-dev.c

index 57eb53b8ac21730abe9622d4913af07e53f5d80a..2937ba3afb7b57635c8f8feed0dc68a4b6c40ef7 100644 (file)
@@ -854,7 +854,7 @@ static int ccp5_init(struct ccp_device *ccp)
 
        if (ccp->cmd_q_count == 0) {
                dev_notice(dev, "no command queues available\n");
-               ret = -EIO;
+               ret = 1;
                goto e_pool;
        }
 
index 73acf0fdb7932b3929f6aaffa2e19c60db1273d4..19ac509ed76e3633f10feddaee6bbd4a31d599b2 100644 (file)
@@ -641,18 +641,27 @@ int ccp_dev_init(struct sp_device *sp)
                ccp->vdata->setup(ccp);
 
        ret = ccp->vdata->perform->init(ccp);
-       if (ret)
+       if (ret) {
+               /* A positive number means that the device cannot be initialized,
+                * but no additional message is required.
+                */
+               if (ret > 0)
+                       goto e_quiet;
+
+               /* An unexpected problem occurred, and should be reported in the log */
                goto e_err;
+       }
 
        dev_notice(dev, "ccp enabled\n");
 
        return 0;
 
 e_err:
-       sp->ccp_data = NULL;
-
        dev_notice(dev, "ccp initialization failed\n");
 
+e_quiet:
+       sp->ccp_data = NULL;
+
        return ret;
 }