crypto: qat - fix get instance function
authorTadeusz Struk <tadeusz.struk@intel.com>
Thu, 22 Oct 2015 13:30:36 +0000 (06:30 -0700)
committerHerbert Xu <herbert@gondor.apana.org.au>
Tue, 17 Nov 2015 13:58:36 +0000 (21:58 +0800)
Fix the logic in case we have found a device on a given node.

Signed-off-by: Tadeusz Struk <tadeusz.struk@intel.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/qat/qat_common/qat_crypto.c

index 9cab15497f0470ee710cc9e1d4df31b43a64b773..94254028f9041acaf7dc5658a0232e123ca71b1d 100644 (file)
@@ -118,19 +118,19 @@ struct qat_crypto_instance *qat_crypto_get_instance_node(int node)
                        }
                }
        }
-       if (!accel_dev)
-               pr_info("QAT: Could not find a device on node %d\n", node);
-
-       /* Get any started device */
-       list_for_each(itr, adf_devmgr_get_head()) {
-               struct adf_accel_dev *tmp_dev;
 
-               tmp_dev = list_entry(itr, struct adf_accel_dev, list);
+       if (!accel_dev) {
+               pr_info("QAT: Could not find a device on node %d\n", node);
+               /* Get any started device */
+               list_for_each(itr, adf_devmgr_get_head()) {
+                       struct adf_accel_dev *tmp_dev;
 
-               if (adf_dev_started(tmp_dev) &&
-                   !list_empty(&tmp_dev->crypto_list)) {
-                       accel_dev = tmp_dev;
-                       break;
+                       tmp_dev = list_entry(itr, struct adf_accel_dev, list);
+                       if (adf_dev_started(tmp_dev) &&
+                           !list_empty(&tmp_dev->crypto_list)) {
+                               accel_dev = tmp_dev;
+                               break;
+                       }
                }
        }