Skip to contentSkip to conversation

staging: ccree: fix checkpatch errors

PATCH In review [email protected] 2 participants 8 messages Jul 9, 2017 – Jul 11, 2017

Subsystems (2)
lore
Share & tools
lore
#3 lore raw

PATCH 3/5 staging: ccree: remove assignement in conditional

In reply to [email protected]

From: Tyler Olivieri <[email protected]>

Patch to fix following checkpatch error:
ERROR: do not use assignment in if condition

---
 drivers/staging/ccree/ssi_hash.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/staging/ccree/ssi_hash.c +4 -2
index 7e9f273..c66314f 100644
@@ -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);
Signature · 1 line
2.9.4
#0 lore raw

cover staging: ccree: fix checkpatch errors

From: Tyler Olivieri <[email protected]>

This 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(-)
Signature · 1 line
2.9.4
#1 lore raw

PATCH 1/5 staging: ccree: remove redudant semicolons

From: Tyler Olivieri <[email protected]>

Patch to remove checkpatch warning:
WARNING: Statements terminations use 1 semicolon

---
 drivers/staging/ccree/ssi_buffer_mgr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/ccree/ssi_buffer_mgr.c +1 -1
index b35871e..c05cd67 100644
@@ -150,7 +150,7 @@ static inline int ssi_buffer_mgr_render_buff_to_mlli(
 	u32 **mlli_entry_pp)
 {
 	u32 *mlli_entry_p = *mlli_entry_pp;
-	u32 new_nents;;
+	u32 new_nents;
 
 	/* Verify there is no memory overflow*/
 	new_nents = (*curr_nents + buff_size / CC_MAX_MLLI_ENTRY_SIZE + 1);
Signature · 1 line
2.9.4
#2 lore raw

PATCH 2/5 staging: ccree: fix placement of curly braces

In reply to [email protected]

From: Tyler Olivieri <[email protected]>

Patch 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

---
 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(-)
drivers/staging/ccree/ssi_buffer_mgr.c +4 -8
index c05cd67..cbf672b 100644
@@ -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)
drivers/staging/ccree/ssi_cipher.c +4 -2
index cd2eafc..4ef0c9b 100644
@@ -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) {
drivers/staging/ccree/ssi_driver.c +1 -4
index 78709b92..d396474 100644
@@ -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 = &new_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));
drivers/staging/ccree/ssi_fips_ll.c +28 -57

234 lines not on this page · raw message

drivers/staging/ccree/ssi_hash.c +2 -1
index ae8f36a..7e9f273 100644
@@ -2366,7 +2366,8 @@ int ssi_hash_free(struct ssi_drvdata *drvdata)
 
 static void ssi_hash_create_xcbc_setup(struct ahash_request *areq,
 				  struct cc_hw_desc desc[],
-				  unsigned int *seq_size) {
+				  unsigned int *seq_size)
+{
 	unsigned int idx = *seq_size;
 	struct ahash_req_ctx *state = ahash_request_ctx(areq);
 	struct crypto_ahash *tfm = crypto_ahash_reqtfm(areq);
drivers/staging/ccree/ssi_sysfs.c +1 -2
index dbcd163..07b634c 100644
@@ -40,8 +40,7 @@ struct stat_name {
 	const char *stat_phase_name[MAX_STAT_PHASES];
 };
 
-static struct stat_name stat_name_db[MAX_STAT_OP_TYPES] =
-{
+static struct stat_name stat_name_db[MAX_STAT_OP_TYPES] = {
 	{
 		/* STAT_OP_TYPE_NULL */
 		.op_type_name = "NULL",
Signature · 1 line
2.9.4
#4 lore raw

PATCH 4/5 staging: ccree: export symbol immediately following function

In reply to [email protected]

From: Tyler Olivieri <[email protected]>

Patch to fix following checkpatch warning:
WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable

---
 drivers/staging/ccree/ssi_fips.c | 2 --
 1 file changed, 2 deletions(-)
drivers/staging/ccree/ssi_fips.c +0 -2
index fdc40f3..523057c 100644
@@ -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);
Signature · 1 line
2.9.4
#5 lore raw

PATCH 5/5 staging: ccree: fix switch case indentation

In reply to [email protected]

From: Tyler Olivieri <[email protected]>

Patch to fix following checkpatch error:
ERROR: switch and case should be at the same indent

---
 drivers/staging/ccree/ssi_hash.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)
drivers/staging/ccree/ssi_hash.c +12 -12
index c66314f..4f596eb 100644
@@ -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;
Signature · 1 line
2.9.4
Acked-by on the v1 series
#6 lore raw
In reply to [email protected]
Quoted 29 lines · On Mon, Jul 10, 2017 at 12:10 AM, <[email protected]> wrote:

From: Tyler Olivieri <[email protected]>

This 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(-)
Quoted 3 lines

--
2.9.4

Looks good to me.

Thanks!

Gilad

Signature · 6 lines
Gilad Ben-Yossef
Chief Coffee Drinker

"If you take a class in large-scale robotics, can you end up in a
situation where the homework eats your dog?"
 -- Jean-Baptiste Queru
#7 lore raw

Tyler,

Quoted 4 lines · Gilad Ben-Yossef
Quoted 3 lines · On Mon, Jul 10, 2017 at 12:10 AM, <[email protected]> wrote:

From: Tyler Olivieri <[email protected]>

This patchset fixes several checkpatch errors and warnings in /staging/ccree:

You've messed Greg's email address, so my ACK bounced.

The content is good, but I don't know if Greg saw the patch set. You might want to resend it.

Gilad.

Signature · 6 lines
Gilad Ben-Yossef
Chief Coffee Drinker

"If you take a class in large-scale robotics, can you end up in a
situation where the homework eats your dog?"
 -- Jean-Baptiste Queru