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>
This commit is contained in:
committed by
Leonard Crestez
parent
09030c7e27
commit
b7385ab947
@ -605,7 +605,6 @@ u32 slot_get_slot_size(struct device *dev, u32 unit, u32 slot)
|
|||||||
int kso_init_data(struct device *dev, u32 unit)
|
int kso_init_data(struct device *dev, u32 unit)
|
||||||
{
|
{
|
||||||
struct caam_drv_private_sm *smpriv = dev_get_drvdata(dev);
|
struct caam_drv_private_sm *smpriv = dev_get_drvdata(dev);
|
||||||
int retval = -EINVAL;
|
|
||||||
struct keystore_data *keystore_data = NULL;
|
struct keystore_data *keystore_data = NULL;
|
||||||
u32 slot_count;
|
u32 slot_count;
|
||||||
u32 keystore_data_size;
|
u32 keystore_data_size;
|
||||||
@ -625,10 +624,8 @@ int kso_init_data(struct device *dev, u32 unit)
|
|||||||
|
|
||||||
keystore_data = kzalloc(keystore_data_size, GFP_KERNEL);
|
keystore_data = kzalloc(keystore_data_size, GFP_KERNEL);
|
||||||
|
|
||||||
if (keystore_data == NULL) {
|
if (!keystore_data)
|
||||||
retval = -ENOSPC;
|
return -ENOMEM;
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef SM_DEBUG
|
#ifdef SM_DEBUG
|
||||||
dev_info(dev, "kso_init_data: keystore data size = %d\n",
|
dev_info(dev, "kso_init_data: keystore data size = %d\n",
|
||||||
@ -649,15 +646,7 @@ int kso_init_data(struct device *dev, u32 unit)
|
|||||||
smpriv->pagedesc[unit].ksdata->phys_address =
|
smpriv->pagedesc[unit].ksdata->phys_address =
|
||||||
smpriv->pagedesc[unit].pg_phys;
|
smpriv->pagedesc[unit].pg_phys;
|
||||||
|
|
||||||
retval = 0;
|
return 0;
|
||||||
|
|
||||||
out:
|
|
||||||
if (retval != 0)
|
|
||||||
if (keystore_data != NULL)
|
|
||||||
kfree(keystore_data);
|
|
||||||
|
|
||||||
|
|
||||||
return retval;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void kso_cleanup_data(struct device *dev, u32 unit)
|
void kso_cleanup_data(struct device *dev, u32 unit)
|
||||||
|
|||||||
Reference in New Issue
Block a user