summaryrefslogtreecommitdiff
path: root/drivers/crypto/caam
diff options
context:
space:
mode:
authorFranck LENORMAND <franck.lenormand@nxp.com>2018-11-23 11:37:28 +0100
committerJason Liu <jason.hui.liu@nxp.com>2019-02-12 10:35:35 +0800
commit7451aba1e73574935924e365490959e9d7092006 (patch)
tree81637ce1ee79857c3408f7e67ea440598ada3a3a /drivers/crypto/caam
parent39603fd68e623961855ceacbf68e1acb70218f3c (diff)
MLK-20204: drivers: crypto: caam: sm: Remove deadcode
There was some code to free the keystore but the current state of the function make this code unreachable so remove it. Coverity explanation: drivers/crypto/caam/sm_store.c:654: CID 17839 (#1 of 1): Type: Logically dead code (DEADCODE) Classification: Bug Severity: Major Action: Fix Required Owner: nxa21133 Defect only exists locally. drivers/crypto/caam/sm_store.c:625: cond_null: Condition "keystore_data == NULL", taking true branch. Now the value of "keystore_data" is "NULL". drivers/crypto/caam/sm_store.c:653: null: At condition "keystore_data != NULL", the value of "keystore_data" must be "NULL". drivers/crypto/caam/sm_store.c:653: dead_error_condition: The condition "keystore_data != NULL" cannot be true. drivers/crypto/caam/sm_store.c:654: dead_error_line: Execution cannot reach this statement: "kfree(keystore_data);". Signed-off-by: Franck LENORMAND <franck.lenormand@nxp.com>
Diffstat (limited to 'drivers/crypto/caam')
-rw-r--r--drivers/crypto/caam/sm_store.c17
1 files changed, 3 insertions, 14 deletions
diff --git a/drivers/crypto/caam/sm_store.c b/drivers/crypto/caam/sm_store.c
index df18f1b209ff..3f1dd914bb69 100644
--- a/drivers/crypto/caam/sm_store.c
+++ b/drivers/crypto/caam/sm_store.c
@@ -602,7 +602,6 @@ u32 slot_get_slot_size(struct device *dev, u32 unit, u32 slot)
int kso_init_data(struct device *dev, u32 unit)
{
struct caam_drv_private_sm *smpriv = dev_get_drvdata(dev);
- int retval = -EINVAL;
struct keystore_data *keystore_data = NULL;
u32 slot_count;
u32 keystore_data_size;
@@ -622,10 +621,8 @@ int kso_init_data(struct device *dev, u32 unit)
keystore_data = kzalloc(keystore_data_size, GFP_KERNEL);
- if (keystore_data == NULL) {
- retval = -ENOSPC;
- goto out;
- }
+ if (!keystore_data)
+ return -ENOMEM;
#ifdef SM_DEBUG
dev_info(dev, "kso_init_data: keystore data size = %d\n",
@@ -646,15 +643,7 @@ int kso_init_data(struct device *dev, u32 unit)
smpriv->pagedesc[unit].ksdata->phys_address =
smpriv->pagedesc[unit].pg_phys;
- retval = 0;
-
-out:
- if (retval != 0)
- if (keystore_data != NULL)
- kfree(keystore_data);
-
-
- return retval;
+ return 0;
}
void kso_cleanup_data(struct device *dev, u32 unit)