[PATCH 3/5] staging: ccree: remove assignement in conditional
From: Tyler OlivieriPatch to fix following checkpatch error: ERROR: do not use assignment in if condition Signed-off-by: Tyler Olivieri --- drivers/staging/ccree/ssi_hash.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/staging/ccree/ssi_hash.c b/drivers/staging/ccree/ssi_hash.c index 7e9f273..c66314f 100644 --- a/drivers/staging/ccree/ssi_hash.c +++ b/drivers/staging/ccree/ssi_hash.c @@ -602,7 +602,8 @@ static int ssi_hash_update(struct ahash_req_ctx *state, return 0; } - if (unlikely(rc = ssi_buffer_mgr_map_hash_request_update(ctx->drvdata, state, src, nbytes, block_size))) { + rc = ssi_buffer_mgr_map_hash_request_update(ctx->drvdata, state, src, nbytes, block_size); + if (unlikely(rc)) { if (rc == 1) { SSI_LOG_DEBUG(" data size not require HW update %x\n", nbytes); @@ -1404,7 +1405,8 @@ static int ssi_mac_update(struct ahash_request *req) state->xcbc_count++; - if (unlikely(rc = ssi_buffer_mgr_map_hash_request_update(ctx->drvdata, state, req->src, req->nbytes, block_size))) { + rc = ssi_buffer_mgr_map_hash_request_update(ctx->drvdata, state, req->src, req->nbytes, block_size); + if (unlikely(rc)) { if (rc == 1) { SSI_LOG_DEBUG(" data size not require HW update %x\n", req->nbytes); -- 2.9.4
[PATCH 0/5] staging: ccree: fix checkpatch errors
From: Tyler OlivieriThis patchset fixes several checkpatch errors and warnings in /staging/ccree: ERROR: that open brace { should be on the previous line ERROR: open brace '{' following function declarations go on the next line WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable ERROR: do not use assignment in if condition ERROR: switch and case should be at the same indent WARNING: Statements terminations use 1 semicolon This is also a submission for the eudyptula challenge. Tyler Olivieri (5): staging: ccree: remove redudant semicolons staging: ccree: fix placement of curly braces staging: ccree: remove assignement in conditional staging: ccree: export symbol immediately following function staging: ccree: fix switch case indentation drivers/staging/ccree/ssi_buffer_mgr.c | 14 ++ drivers/staging/ccree/ssi_cipher.c | 6 ++- drivers/staging/ccree/ssi_driver.c | 5 +- drivers/staging/ccree/ssi_fips.c | 2 - drivers/staging/ccree/ssi_fips_ll.c| 85 +++--- drivers/staging/ccree/ssi_hash.c | 33 +++-- drivers/staging/ccree/ssi_sysfs.c | 3 +- 7 files changed, 57 insertions(+), 91 deletions(-) -- 2.9.4
[PATCH 2/5] staging: ccree: fix placement of curly braces
From: Tyler OlivieriPatch to fix checkpatch errors: ERROR: that open brace { should be on the previous line ERROR: open brace '{' following function declarations go on the next line Signed-off-by: Tyler Olivieri --- drivers/staging/ccree/ssi_buffer_mgr.c | 12 ++--- drivers/staging/ccree/ssi_cipher.c | 6 ++- drivers/staging/ccree/ssi_driver.c | 5 +- drivers/staging/ccree/ssi_fips_ll.c| 85 +++--- drivers/staging/ccree/ssi_hash.c | 3 +- drivers/staging/ccree/ssi_sysfs.c | 3 +- 6 files changed, 40 insertions(+), 74 deletions(-) diff --git a/drivers/staging/ccree/ssi_buffer_mgr.c b/drivers/staging/ccree/ssi_buffer_mgr.c index c05cd67..cbf672b 100644 --- a/drivers/staging/ccree/ssi_buffer_mgr.c +++ b/drivers/staging/ccree/ssi_buffer_mgr.c @@ -696,8 +696,7 @@ void ssi_buffer_mgr_unmap_aead_request( } if (drvdata->coherent && (areq_ctx->gen_ctx.op_type == DRV_CRYPTO_DIRECTION_DECRYPT) && - likely(req->src == req->dst)) - { + likely(req->src == req->dst)) { u32 size_to_skip = req->assoclen; if (areq_ctx->is_gcm4543) @@ -1134,8 +1133,7 @@ static inline int ssi_buffer_mgr_aead_chain_data( sg_index += areq_ctx->srcSgl->length; src_mapped_nents--; } - if (unlikely(src_mapped_nents > LLI_MAX_NUM_OF_DATA_ENTRIES)) - { + if (unlikely(src_mapped_nents > LLI_MAX_NUM_OF_DATA_ENTRIES)) { SSI_LOG_ERR("Too many fragments. current %d max %d\n", src_mapped_nents, LLI_MAX_NUM_OF_DATA_ENTRIES); return -ENOMEM; @@ -1177,8 +1175,7 @@ static inline int ssi_buffer_mgr_aead_chain_data( sg_index += areq_ctx->dstSgl->length; dst_mapped_nents--; } - if (unlikely(dst_mapped_nents > LLI_MAX_NUM_OF_DATA_ENTRIES)) - { + if (unlikely(dst_mapped_nents > LLI_MAX_NUM_OF_DATA_ENTRIES)) { SSI_LOG_ERR("Too many fragments. current %d max %d\n", dst_mapped_nents, LLI_MAX_NUM_OF_DATA_ENTRIES); return -ENOMEM; @@ -1274,8 +1271,7 @@ int ssi_buffer_mgr_map_aead_request( if (drvdata->coherent && (areq_ctx->gen_ctx.op_type == DRV_CRYPTO_DIRECTION_DECRYPT) && - likely(req->src == req->dst)) - { + likely(req->src == req->dst)) { u32 size_to_skip = req->assoclen; if (is_gcm4543) diff --git a/drivers/staging/ccree/ssi_cipher.c b/drivers/staging/ccree/ssi_cipher.c index cd2eafc..4ef0c9b 100644 --- a/drivers/staging/ccree/ssi_cipher.c +++ b/drivers/staging/ccree/ssi_cipher.c @@ -68,7 +68,8 @@ struct ssi_ablkcipher_ctx { static void ssi_ablkcipher_complete(struct device *dev, void *ssi_req, void __iomem *cc_base); -static int validate_keys_sizes(struct ssi_ablkcipher_ctx *ctx_p, u32 size) { +static int validate_keys_sizes(struct ssi_ablkcipher_ctx *ctx_p, u32 size) +{ switch (ctx_p->flow_mode) { case S_DIN_to_AES: switch (size) { @@ -108,7 +109,8 @@ static int validate_keys_sizes(struct ssi_ablkcipher_ctx *ctx_p, u32 size) { return -EINVAL; } -static int validate_data_size(struct ssi_ablkcipher_ctx *ctx_p, unsigned int size) { +static int validate_data_size(struct ssi_ablkcipher_ctx *ctx_p, unsigned int size) +{ switch (ctx_p->flow_mode) { case S_DIN_to_AES: switch (ctx_p->cipher_mode) { diff --git a/drivers/staging/ccree/ssi_driver.c b/drivers/staging/ccree/ssi_driver.c index 78709b92..d396474 100644 --- a/drivers/staging/ccree/ssi_driver.c +++ b/drivers/staging/ccree/ssi_driver.c @@ -301,13 +301,10 @@ static int init_cc_resources(struct platform_device *plat_dev) goto init_cc_res_err; if (!new_drvdata->plat_dev->dev.dma_mask) - { new_drvdata->plat_dev->dev.dma_mask = _drvdata->plat_dev->dev.coherent_dma_mask; - } + if (!new_drvdata->plat_dev->dev.coherent_dma_mask) - { new_drvdata->plat_dev->dev.coherent_dma_mask = DMA_BIT_MASK(DMA_BIT_MASK_LEN); - } /* Verify correct mapping */ signature_val = CC_HAL_READ_REGISTER(CC_REG_OFFSET(HOST_RGF, HOST_SIGNATURE)); diff --git a/drivers/staging/ccree/ssi_fips_ll.c b/drivers/staging/ccree/ssi_fips_ll.c index 3557e20..4a7a1a6 100644 --- a/drivers/staging/ccree/ssi_fips_ll.c +++ b/drivers/staging/ccree/ssi_fips_ll.c @@ -270,8 +270,7 @@ static const FipsGcmData FipsGcmDataTable[] = { static inline enum cc_fips_error FIPS_CipherToFipsError(enum drv_cipher_mode mode, bool is_aes) { - switch (mode) - { + switch (mode) { case DRV_CIPHER_ECB: return is_aes ? CC_REE_FIPS_ERROR_AES_ECB_PUT : CC_REE_FIPS_ERROR_DES_ECB_PUT; case DRV_CIPHER_CBC: @@ -422,8
[PATCH 5/5] staging: ccree: fix switch case indentation
From: Tyler OlivieriPatch to fix following checkpatch error: ERROR: switch and case should be at the same indent Signed-off-by: Tyler Olivieri --- drivers/staging/ccree/ssi_hash.c | 24 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/staging/ccree/ssi_hash.c b/drivers/staging/ccree/ssi_hash.c index c66314f..4f596eb 100644 --- a/drivers/staging/ccree/ssi_hash.c +++ b/drivers/staging/ccree/ssi_hash.c @@ -1177,12 +1177,12 @@ static int ssi_xcbc_setkey(struct crypto_ahash *ahash, CHECK_AND_RETURN_UPON_FIPS_ERROR(); switch (keylen) { - case AES_KEYSIZE_128: - case AES_KEYSIZE_192: - case AES_KEYSIZE_256: - break; - default: - return -EINVAL; + case AES_KEYSIZE_128: + case AES_KEYSIZE_192: + case AES_KEYSIZE_256: + break; + default: + return -EINVAL; } ctx->key_params.keylen = keylen; @@ -1265,12 +1265,12 @@ static int ssi_cmac_setkey(struct crypto_ahash *ahash, ctx->is_hmac = true; switch (keylen) { - case AES_KEYSIZE_128: - case AES_KEYSIZE_192: - case AES_KEYSIZE_256: - break; - default: - return -EINVAL; + case AES_KEYSIZE_128: + case AES_KEYSIZE_192: + case AES_KEYSIZE_256: + break; + default: + return -EINVAL; } ctx->key_params.keylen = keylen; -- 2.9.4
[PATCH 4/5] staging: ccree: export symbol immediately following function
From: Tyler OlivieriPatch to fix following checkpatch warning: WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable Signed-off-by: Tyler Olivieri --- drivers/staging/ccree/ssi_fips.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/staging/ccree/ssi_fips.c b/drivers/staging/ccree/ssi_fips.c index fdc40f3..523057c 100644 --- a/drivers/staging/ccree/ssi_fips.c +++ b/drivers/staging/ccree/ssi_fips.c @@ -39,7 +39,6 @@ int ssi_fips_get_state(enum cc_fips_state_t *p_state) return rc; } - EXPORT_SYMBOL(ssi_fips_get_state); /* @@ -57,5 +56,4 @@ int ssi_fips_get_error(enum cc_fips_error *p_err) return rc; } - EXPORT_SYMBOL(ssi_fips_get_error); -- 2.9.4