[PATCH v2] Staging: ccree: Use kcalloc instead of kzalloc
Use kcalloc instead of kzalloc to check for overflow before multiplication. Done using the following semantic patch by coccinelle. http://coccinelle.lip6.fr/rules/kzalloc.cocci Signed-off-by: Srishti Sharma <srishtis...@gmail.com> --- Changes in v2: - eliminate parentheses around the first argument drivers/staging/ccree/ssi_sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/ccree/ssi_sysfs.c b/drivers/staging/ccree/ssi_sysfs.c index 0655658..f7e0c502 100644 --- a/drivers/staging/ccree/ssi_sysfs.c +++ b/drivers/staging/ccree/ssi_sysfs.c @@ -376,7 +376,7 @@ static int sys_init_dir(struct sys_dir *sys_dir, struct ssi_drvdata *drvdata, return -ENOMEM; /* allocate memory for directory's attributes list */ sys_dir->sys_dir_attr_list = - kzalloc(sizeof(struct attribute *) * (num_of_attrs + 1), + kcalloc(num_of_attrs + 1, sizeof(struct attribute *), GFP_KERNEL); if (!(sys_dir->sys_dir_attr_list)) { -- 2.7.4
[PATCH] Staging: ccree: Use kcalloc instead of kzalloc
Use kcalloc instead of kzalloc to check for overflow before multiplication. Done using the following semantic patch by coccinelle. http://coccinelle.lip6.fr/rules/kzalloc.cocci Signed-off-by: Srishti Sharma <srishtis...@gmail.com> --- drivers/staging/ccree/ssi_sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/ccree/ssi_sysfs.c b/drivers/staging/ccree/ssi_sysfs.c index 0655658..65a0529 100644 --- a/drivers/staging/ccree/ssi_sysfs.c +++ b/drivers/staging/ccree/ssi_sysfs.c @@ -376,7 +376,7 @@ static int sys_init_dir(struct sys_dir *sys_dir, struct ssi_drvdata *drvdata, return -ENOMEM; /* allocate memory for directory's attributes list */ sys_dir->sys_dir_attr_list = - kzalloc(sizeof(struct attribute *) * (num_of_attrs + 1), + kcalloc((num_of_attrs + 1), sizeof(struct attribute *), GFP_KERNEL); if (!(sys_dir->sys_dir_attr_list)) { -- 2.7.4
Re: [PATCH] Staging: ccree: Don't use volatile for monitor_lock
On Tue, Sep 12, 2017 at 2:49 PM, Dan Carpenter <dan.carpen...@oracle.com> wrote: > On Mon, Sep 11, 2017 at 09:29:31PM +0530, Srishti Sharma wrote: >> The use of volatile for the variable monitor_lock is unnecessary. >> >> Signed-off-by: Srishti Sharma <srishtis...@gmail.com> >> --- >> drivers/staging/ccree/ssi_request_mgr.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/drivers/staging/ccree/ssi_request_mgr.c >> b/drivers/staging/ccree/ssi_request_mgr.c >> index e5c2f92..7d77941 100644 >> --- a/drivers/staging/ccree/ssi_request_mgr.c >> +++ b/drivers/staging/ccree/ssi_request_mgr.c >> @@ -49,7 +49,7 @@ struct ssi_request_mgr_handle { >> dma_addr_t dummy_comp_buff_dma; >> struct cc_hw_desc monitor_desc; >> >> - volatile unsigned long monitor_lock; >> + unsigned long monitor_lock; > > The variable seems unused. Try deleting it instead. Had already sent a patch for that as v2. Thanks Srishti > regards, > dan carpenter >
Re: [PATCH v2] Staging: ccree: Prefer using BIT macro.
On Mon, Sep 11, 2017 at 9:54 PM, Greg KH <gre...@linuxfoundation.org> wrote: > On Thu, Sep 07, 2017 at 07:44:52PM +0530, Srishti Sharma wrote: >> Use BIT(x) instead of using (1<<x), reported by checkpatch.pl. >> >> Signed-off-by: Srishti Sharma <srishtis...@gmail.com> >> --- >> Changes in v2: >> - Add tab spaces before BIT macro. >> >> drivers/staging/ccree/ssi_cipher.h | 10 +- >> 1 file changed, 5 insertions(+), 5 deletions(-) > > This change is already in my tree from someone else, sorry. Oh.. It's okay ! Thanks, Srishti > > greg k-h
Re: [Outreachy kernel] Re: [PATCH] Staging: ccree: Don't use volatile for monitor_lock
On Mon, Sep 11, 2017 at 9:45 PM, Srishti Sharma <srishtis...@gmail.com> wrote: > On Mon, Sep 11, 2017 at 9:41 PM, Julia Lawall <julia.law...@lip6.fr> wrote: >> >> >> On Mon, 11 Sep 2017, Srishti Sharma wrote: >> >>> On Mon, Sep 11, 2017 at 9:34 PM, Greg KH <gre...@linuxfoundation.org> wrote: >>> > On Mon, Sep 11, 2017 at 09:29:31PM +0530, Srishti Sharma wrote: >>> >> The use of volatile for the variable monitor_lock is unnecessary. >>> >> >>> >> Signed-off-by: Srishti Sharma <srishtis...@gmail.com> >>> >> --- >>> >> drivers/staging/ccree/ssi_request_mgr.c | 2 +- >>> >> 1 file changed, 1 insertion(+), 1 deletion(-) >>> >> >>> >> diff --git a/drivers/staging/ccree/ssi_request_mgr.c >>> >> b/drivers/staging/ccree/ssi_request_mgr.c >>> >> index e5c2f92..7d77941 100644 >>> >> --- a/drivers/staging/ccree/ssi_request_mgr.c >>> >> +++ b/drivers/staging/ccree/ssi_request_mgr.c >>> >> @@ -49,7 +49,7 @@ struct ssi_request_mgr_handle { >>> >> dma_addr_t dummy_comp_buff_dma; >>> >> struct cc_hw_desc monitor_desc; >>> >> >>> >> - volatile unsigned long monitor_lock; >>> >> + unsigned long monitor_lock; >>> > >>> > While volatile is not right, odds are, this is still totally wrong as >>> > well. How about using a "real" lock instead? >>> >>> I tried to find where is this variable being used in the code, but I >>> didn't find any usage of it . It might be an important attribute of >>> this structure definition but, I don't see it's value being set to >>> anything or being used somewhere . >> >> Try removing it and see if the code still compiles. There is always a >> danger that a use of something could be constructed using ## in a macro, >> although given the uses of ## for this driver, it doesn't seem likely >> here. It compiles, so I have removed the variable and sent another patch Thanks, Srishti > > Yes, I'll do that. > > Regards, > Srishti >> >> julia
[PATCH v2] Staging: ccree: Remove unused variable monitor_lock
Remove the variable monitor_lock as it is not used anywhere. Signed-off-by: Srishti Sharma <srishtis...@gmail.com> --- Changes in v2: -The variable that was not to be declared as volatile can be eliminated as it is not being used anywhere. drivers/staging/ccree/ssi_request_mgr.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/staging/ccree/ssi_request_mgr.c b/drivers/staging/ccree/ssi_request_mgr.c index e5c2f92..b94a91f 100644 --- a/drivers/staging/ccree/ssi_request_mgr.c +++ b/drivers/staging/ccree/ssi_request_mgr.c @@ -49,7 +49,6 @@ struct ssi_request_mgr_handle { dma_addr_t dummy_comp_buff_dma; struct cc_hw_desc monitor_desc; - volatile unsigned long monitor_lock; #ifdef COMP_IN_WQ struct workqueue_struct *workq; struct delayed_work compwork; -- 2.7.4
Re: [Outreachy kernel] Re: [PATCH] Staging: ccree: Don't use volatile for monitor_lock
On Mon, Sep 11, 2017 at 9:41 PM, Julia Lawall <julia.law...@lip6.fr> wrote: > > > On Mon, 11 Sep 2017, Srishti Sharma wrote: > >> On Mon, Sep 11, 2017 at 9:34 PM, Greg KH <gre...@linuxfoundation.org> wrote: >> > On Mon, Sep 11, 2017 at 09:29:31PM +0530, Srishti Sharma wrote: >> >> The use of volatile for the variable monitor_lock is unnecessary. >> >> >> >> Signed-off-by: Srishti Sharma <srishtis...@gmail.com> >> >> --- >> >> drivers/staging/ccree/ssi_request_mgr.c | 2 +- >> >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> >> >> diff --git a/drivers/staging/ccree/ssi_request_mgr.c >> >> b/drivers/staging/ccree/ssi_request_mgr.c >> >> index e5c2f92..7d77941 100644 >> >> --- a/drivers/staging/ccree/ssi_request_mgr.c >> >> +++ b/drivers/staging/ccree/ssi_request_mgr.c >> >> @@ -49,7 +49,7 @@ struct ssi_request_mgr_handle { >> >> dma_addr_t dummy_comp_buff_dma; >> >> struct cc_hw_desc monitor_desc; >> >> >> >> - volatile unsigned long monitor_lock; >> >> + unsigned long monitor_lock; >> > >> > While volatile is not right, odds are, this is still totally wrong as >> > well. How about using a "real" lock instead? >> >> I tried to find where is this variable being used in the code, but I >> didn't find any usage of it . It might be an important attribute of >> this structure definition but, I don't see it's value being set to >> anything or being used somewhere . > > Try removing it and see if the code still compiles. There is always a > danger that a use of something could be constructed using ## in a macro, > although given the uses of ## for this driver, it doesn't seem likely > here. Yes, I'll do that. Regards, Srishti > > julia
Re: [PATCH] Staging: ccree: Don't use volatile for monitor_lock
On Mon, Sep 11, 2017 at 9:34 PM, Greg KH <gre...@linuxfoundation.org> wrote: > On Mon, Sep 11, 2017 at 09:29:31PM +0530, Srishti Sharma wrote: >> The use of volatile for the variable monitor_lock is unnecessary. >> >> Signed-off-by: Srishti Sharma <srishtis...@gmail.com> >> --- >> drivers/staging/ccree/ssi_request_mgr.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/drivers/staging/ccree/ssi_request_mgr.c >> b/drivers/staging/ccree/ssi_request_mgr.c >> index e5c2f92..7d77941 100644 >> --- a/drivers/staging/ccree/ssi_request_mgr.c >> +++ b/drivers/staging/ccree/ssi_request_mgr.c >> @@ -49,7 +49,7 @@ struct ssi_request_mgr_handle { >> dma_addr_t dummy_comp_buff_dma; >> struct cc_hw_desc monitor_desc; >> >> - volatile unsigned long monitor_lock; >> + unsigned long monitor_lock; > > While volatile is not right, odds are, this is still totally wrong as > well. How about using a "real" lock instead? I tried to find where is this variable being used in the code, but I didn't find any usage of it . It might be an important attribute of this structure definition but, I don't see it's value being set to anything or being used somewhere . Regards, Srishti > > thanks, > > greg k-h
[PATCH] Staging: ccree: Don't use volatile for monitor_lock
The use of volatile for the variable monitor_lock is unnecessary. Signed-off-by: Srishti Sharma <srishtis...@gmail.com> --- drivers/staging/ccree/ssi_request_mgr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/ccree/ssi_request_mgr.c b/drivers/staging/ccree/ssi_request_mgr.c index e5c2f92..7d77941 100644 --- a/drivers/staging/ccree/ssi_request_mgr.c +++ b/drivers/staging/ccree/ssi_request_mgr.c @@ -49,7 +49,7 @@ struct ssi_request_mgr_handle { dma_addr_t dummy_comp_buff_dma; struct cc_hw_desc monitor_desc; - volatile unsigned long monitor_lock; + unsigned long monitor_lock; #ifdef COMP_IN_WQ struct workqueue_struct *workq; struct delayed_work compwork; -- 2.7.4
Re: [Outreachy kernel] [PATCH] Staging: ccree: Merge assignment with return
On Sat, Sep 9, 2017 at 10:29 PM, Julia Lawall <julia.law...@lip6.fr> wrote: > > > On Sat, 9 Sep 2017, Srishti Sharma wrote: > >> Merge the assignment and return statements to return the value >> directly. Done using coccinelle. > > Coccinelle is not always perfect about pretty printing, so you have to > watch out for it. > >> >> @@ >> local idexpression ret; >> expression e; >> @@ >> >> -ret = >> +return >> e; >> -return ret; >> >> Signed-off-by: Srishti Sharma <srishtis...@gmail.com> >> --- >> drivers/staging/ccree/ssi_sysfs.c | 4 +--- >> 1 file changed, 1 insertion(+), 3 deletions(-) >> >> diff --git a/drivers/staging/ccree/ssi_sysfs.c >> b/drivers/staging/ccree/ssi_sysfs.c >> index 0655658..9fa7be0 100644 >> --- a/drivers/staging/ccree/ssi_sysfs.c >> +++ b/drivers/staging/ccree/ssi_sysfs.c >> @@ -412,7 +412,6 @@ static void sys_free_dir(struct sys_dir *sys_dir) >> >> int ssi_sysfs_init(struct kobject *sys_dev_obj, struct ssi_drvdata *drvdata) >> { >> - int retval; >> > > This is going to leave a single empty line at the top of the function. > That is not needed. > >> #if defined CC_CYCLE_COUNT >> /* Init. statistics */ >> @@ -423,10 +422,9 @@ int ssi_sysfs_init(struct kobject *sys_dev_obj, struct >> ssi_drvdata *drvdata) >> SSI_LOG_ERR("setup sysfs under %s\n", sys_dev_obj->name); >> >> /* Initialize top directory */ >> - retval = sys_init_dir(_top_dir, drvdata, sys_dev_obj, "cc_info", >> + return sys_init_dir(_top_dir, drvdata, sys_dev_obj, "cc_info", >> ssi_sys_top_level_attrs, >> ARRAY_SIZE(ssi_sys_top_level_attrs)); > > Previously the arguments were lined up with the right side of the ( but > now they are not. So move the above two lines to the left by 2 spaces. Thanks for this , I have re-sent the patch . Regards, Srishti > julia > >> - return retval; >> } >> >> void ssi_sysfs_fini(void) >> -- >> 2.7.4 >> >> -- >> You received this message because you are subscribed to the Google Groups >> "outreachy-kernel" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to outreachy-kernel+unsubscr...@googlegroups.com. >> To post to this group, send email to outreachy-ker...@googlegroups.com. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/outreachy-kernel/1504953861-3221-1-git-send-email-srishtishar%40gmail.com. >> For more options, visit https://groups.google.com/d/optout. >>
[PATCH v2] Staging: ccree: Merge assignment with return
Merge the assignment and return statements to return the value directly. Done using the following semantic patch by coccinelle. @@ local idexpression ret; expression e; @@ -ret = +return e; -return ret; Signed-off-by: Srishti Sharma <srishtis...@gmail.com> --- Changes in v2: -Correct coding style problems drivers/staging/ccree/ssi_sysfs.c | 9 +++-- 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/staging/ccree/ssi_sysfs.c b/drivers/staging/ccree/ssi_sysfs.c index 0655658..ed662cb 100644 --- a/drivers/staging/ccree/ssi_sysfs.c +++ b/drivers/staging/ccree/ssi_sysfs.c @@ -412,8 +412,6 @@ static void sys_free_dir(struct sys_dir *sys_dir) int ssi_sysfs_init(struct kobject *sys_dev_obj, struct ssi_drvdata *drvdata) { - int retval; - #if defined CC_CYCLE_COUNT /* Init. statistics */ init_db(stat_host_db); @@ -423,10 +421,9 @@ int ssi_sysfs_init(struct kobject *sys_dev_obj, struct ssi_drvdata *drvdata) SSI_LOG_ERR("setup sysfs under %s\n", sys_dev_obj->name); /* Initialize top directory */ - retval = sys_init_dir(_top_dir, drvdata, sys_dev_obj, "cc_info", - ssi_sys_top_level_attrs, - ARRAY_SIZE(ssi_sys_top_level_attrs)); - return retval; + return sys_init_dir(_top_dir, drvdata, sys_dev_obj, "cc_info", + ssi_sys_top_level_attrs, + ARRAY_SIZE(ssi_sys_top_level_attrs)); } void ssi_sysfs_fini(void) -- 2.7.4
[PATCH] Staging: ccree: Merge assignment with return
Merge the assignment and return statements to return the value directly. Done using coccinelle. @@ local idexpression ret; expression e; @@ -ret = +return e; -return ret; Signed-off-by: Srishti Sharma <srishtis...@gmail.com> --- drivers/staging/ccree/ssi_sysfs.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/staging/ccree/ssi_sysfs.c b/drivers/staging/ccree/ssi_sysfs.c index 0655658..9fa7be0 100644 --- a/drivers/staging/ccree/ssi_sysfs.c +++ b/drivers/staging/ccree/ssi_sysfs.c @@ -412,7 +412,6 @@ static void sys_free_dir(struct sys_dir *sys_dir) int ssi_sysfs_init(struct kobject *sys_dev_obj, struct ssi_drvdata *drvdata) { - int retval; #if defined CC_CYCLE_COUNT /* Init. statistics */ @@ -423,10 +422,9 @@ int ssi_sysfs_init(struct kobject *sys_dev_obj, struct ssi_drvdata *drvdata) SSI_LOG_ERR("setup sysfs under %s\n", sys_dev_obj->name); /* Initialize top directory */ - retval = sys_init_dir(_top_dir, drvdata, sys_dev_obj, "cc_info", + return sys_init_dir(_top_dir, drvdata, sys_dev_obj, "cc_info", ssi_sys_top_level_attrs, ARRAY_SIZE(ssi_sys_top_level_attrs)); - return retval; } void ssi_sysfs_fini(void) -- 2.7.4
Re: [Outreachy kernel] [PATCH v3] Staging: ccree: Merge assignment with return
On Sat, Sep 9, 2017 at 12:26 PM, Julia Lawall <julia.law...@lip6.fr> wrote: > > > On Sat, 9 Sep 2017, Srishti Sharma wrote: > >> Merge the assignment and return statements to return the value >> directly. Done using coccinelle. >> >> @@ >> local idexpression ret; >> expression e; >> @@ >> >> -ret = >> +return >> e; >> -return ret; >> >> Signed-off-by: Srishti Sharma <srishtis...@gmail.com> >> --- >> Changes in v3: >> -Edit commit message so that it respects 80 character limit. >> -Remove unneeded blank lines, that were added by mistake. >> >> drivers/staging/ccree/ssi_aead.c | 14 +++--- >> 1 file changed, 3 insertions(+), 11 deletions(-) >> >> diff --git a/drivers/staging/ccree/ssi_aead.c >> b/drivers/staging/ccree/ssi_aead.c >> index 5abe6b2..1d3b580 100644 >> --- a/drivers/staging/ccree/ssi_aead.c >> +++ b/drivers/staging/ccree/ssi_aead.c >> @@ -651,7 +651,6 @@ ssi_aead_setkey(struct crypto_aead *tfm, const u8 *key, >> unsigned int keylen) >> static int ssi_rfc4309_ccm_setkey(struct crypto_aead *tfm, const u8 *key, >> unsigned int keylen) >> { >> struct ssi_aead_ctx *ctx = crypto_aead_ctx(tfm); >> - int rc = 0; >> >> if (keylen < 3) >> return -EINVAL; >> @@ -659,9 +658,7 @@ static int ssi_rfc4309_ccm_setkey(struct crypto_aead >> *tfm, const u8 *key, unsign >> keylen -= 3; >> memcpy(ctx->ctr_nonce, key + keylen, 3); >> >> - rc = ssi_aead_setkey(tfm, key, keylen); >> - >> - return rc; >> + return ssi_aead_setkey(tfm, key, keylen); >> } >> #endif /*SSI_CC_HAS_AES_CCM*/ >> >> @@ -2224,15 +2221,12 @@ static int ssi_rfc4106_gcm_setkey(struct crypto_aead >> *tfm, const u8 *key, unsign >> keylen -= 4; >> memcpy(ctx->ctr_nonce, key + keylen, 4); >> >> - rc = ssi_aead_setkey(tfm, key, keylen); >> - >> - return rc; >> + return ssi_aead_setkey(tfm, key, keylen); > > The declaration of rc should be dropped in this case. You should have > gotten a compiler warning. Always compile the code before submitting a > patch, and fix up any warnings. I am very sorry about that, I have re-sent it. Regards, Srishti > julia > >> } >> >> static int ssi_rfc4543_gcm_setkey(struct crypto_aead *tfm, const u8 *key, >> unsigned int keylen) >> { >> struct ssi_aead_ctx *ctx = crypto_aead_ctx(tfm); >> - int rc = 0; >> >> SSI_LOG_DEBUG("%s() keylen %d, key %p\n", __func__, keylen, key); >> >> @@ -2242,9 +2236,7 @@ static int ssi_rfc4543_gcm_setkey(struct crypto_aead >> *tfm, const u8 *key, unsign >> keylen -= 4; >> memcpy(ctx->ctr_nonce, key + keylen, 4); >> >> - rc = ssi_aead_setkey(tfm, key, keylen); >> - >> - return rc; >> + return ssi_aead_setkey(tfm, key, keylen); >> } >> >> static int ssi_gcm_setauthsize(struct crypto_aead *authenc, >> -- >> 2.7.4 >> >> -- >> You received this message because you are subscribed to the Google Groups >> "outreachy-kernel" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to outreachy-kernel+unsubscr...@googlegroups.com. >> To post to this group, send email to outreachy-ker...@googlegroups.com. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/outreachy-kernel/1504907654-4914-1-git-send-email-srishtishar%40gmail.com. >> For more options, visit https://groups.google.com/d/optout. >>
[PATCH v4] Staging: ccree: Merge assignment with return
Merge the assignment and the return statements to return the value directly. Done using coccinelle. @@ local idexpression ret; expression e; @@ -ret = +return e; -return ret; Signed-off-by: Srishti Sharma <srishtis...@gmail.com> --- Changes in v4: -Edit commit message so that it respects 80 character limit -Remove unneeded blank lines -Remove declarations of variables that are not used drivers/staging/ccree/ssi_aead.c | 15 +++ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/drivers/staging/ccree/ssi_aead.c b/drivers/staging/ccree/ssi_aead.c index 5abe6b2..84fcb75 100644 --- a/drivers/staging/ccree/ssi_aead.c +++ b/drivers/staging/ccree/ssi_aead.c @@ -651,7 +651,6 @@ ssi_aead_setkey(struct crypto_aead *tfm, const u8 *key, unsigned int keylen) static int ssi_rfc4309_ccm_setkey(struct crypto_aead *tfm, const u8 *key, unsigned int keylen) { struct ssi_aead_ctx *ctx = crypto_aead_ctx(tfm); - int rc = 0; if (keylen < 3) return -EINVAL; @@ -659,9 +658,7 @@ static int ssi_rfc4309_ccm_setkey(struct crypto_aead *tfm, const u8 *key, unsign keylen -= 3; memcpy(ctx->ctr_nonce, key + keylen, 3); - rc = ssi_aead_setkey(tfm, key, keylen); - - return rc; + return ssi_aead_setkey(tfm, key, keylen); } #endif /*SSI_CC_HAS_AES_CCM*/ @@ -2214,7 +2211,6 @@ static int ssi_rfc4309_ccm_decrypt(struct aead_request *req) static int ssi_rfc4106_gcm_setkey(struct crypto_aead *tfm, const u8 *key, unsigned int keylen) { struct ssi_aead_ctx *ctx = crypto_aead_ctx(tfm); - int rc = 0; SSI_LOG_DEBUG("%s() keylen %d, key %p\n", __func__, keylen, key); @@ -2224,15 +2220,12 @@ static int ssi_rfc4106_gcm_setkey(struct crypto_aead *tfm, const u8 *key, unsign keylen -= 4; memcpy(ctx->ctr_nonce, key + keylen, 4); - rc = ssi_aead_setkey(tfm, key, keylen); - - return rc; + return ssi_aead_setkey(tfm, key, keylen); } static int ssi_rfc4543_gcm_setkey(struct crypto_aead *tfm, const u8 *key, unsigned int keylen) { struct ssi_aead_ctx *ctx = crypto_aead_ctx(tfm); - int rc = 0; SSI_LOG_DEBUG("%s() keylen %d, key %p\n", __func__, keylen, key); @@ -2242,9 +2235,7 @@ static int ssi_rfc4543_gcm_setkey(struct crypto_aead *tfm, const u8 *key, unsign keylen -= 4; memcpy(ctx->ctr_nonce, key + keylen, 4); - rc = ssi_aead_setkey(tfm, key, keylen); - - return rc; + return ssi_aead_setkey(tfm, key, keylen); } static int ssi_gcm_setauthsize(struct crypto_aead *authenc, -- 2.7.4
[PATCH v3] Staging: ccree: Merge assignment with return
Merge the assignment and return statements to return the value directly. Done using coccinelle. @@ local idexpression ret; expression e; @@ -ret = +return e; -return ret; Signed-off-by: Srishti Sharma <srishtis...@gmail.com> --- Changes in v3: -Edit commit message so that it respects 80 character limit. -Remove unneeded blank lines, that were added by mistake. drivers/staging/ccree/ssi_aead.c | 14 +++--- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/drivers/staging/ccree/ssi_aead.c b/drivers/staging/ccree/ssi_aead.c index 5abe6b2..1d3b580 100644 --- a/drivers/staging/ccree/ssi_aead.c +++ b/drivers/staging/ccree/ssi_aead.c @@ -651,7 +651,6 @@ ssi_aead_setkey(struct crypto_aead *tfm, const u8 *key, unsigned int keylen) static int ssi_rfc4309_ccm_setkey(struct crypto_aead *tfm, const u8 *key, unsigned int keylen) { struct ssi_aead_ctx *ctx = crypto_aead_ctx(tfm); - int rc = 0; if (keylen < 3) return -EINVAL; @@ -659,9 +658,7 @@ static int ssi_rfc4309_ccm_setkey(struct crypto_aead *tfm, const u8 *key, unsign keylen -= 3; memcpy(ctx->ctr_nonce, key + keylen, 3); - rc = ssi_aead_setkey(tfm, key, keylen); - - return rc; + return ssi_aead_setkey(tfm, key, keylen); } #endif /*SSI_CC_HAS_AES_CCM*/ @@ -2224,15 +2221,12 @@ static int ssi_rfc4106_gcm_setkey(struct crypto_aead *tfm, const u8 *key, unsign keylen -= 4; memcpy(ctx->ctr_nonce, key + keylen, 4); - rc = ssi_aead_setkey(tfm, key, keylen); - - return rc; + return ssi_aead_setkey(tfm, key, keylen); } static int ssi_rfc4543_gcm_setkey(struct crypto_aead *tfm, const u8 *key, unsigned int keylen) { struct ssi_aead_ctx *ctx = crypto_aead_ctx(tfm); - int rc = 0; SSI_LOG_DEBUG("%s() keylen %d, key %p\n", __func__, keylen, key); @@ -2242,9 +2236,7 @@ static int ssi_rfc4543_gcm_setkey(struct crypto_aead *tfm, const u8 *key, unsign keylen -= 4; memcpy(ctx->ctr_nonce, key + keylen, 4); - rc = ssi_aead_setkey(tfm, key, keylen); - - return rc; + return ssi_aead_setkey(tfm, key, keylen); } static int ssi_gcm_setauthsize(struct crypto_aead *authenc, -- 2.7.4
[PATCH v2] Staging: ccree: Merge assignment with return
Merge the assignment and return statements to return the value directly. Done using coccinelle. @@ local idexpression ret; expression e; @@ -ret = +return e; -return ret; Signed-off-by: Srishti Sharma <srishtis...@gmail.com> --- Changes in v2: - Edit commit message so that it respects the 80 character limit. drivers/staging/ccree/ssi_aead.c | 18 ++ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/drivers/staging/ccree/ssi_aead.c b/drivers/staging/ccree/ssi_aead.c index 5abe6b2..f4532ea 100644 --- a/drivers/staging/ccree/ssi_aead.c +++ b/drivers/staging/ccree/ssi_aead.c @@ -651,7 +651,7 @@ ssi_aead_setkey(struct crypto_aead *tfm, const u8 *key, unsigned int keylen) static int ssi_rfc4309_ccm_setkey(struct crypto_aead *tfm, const u8 *key, unsigned int keylen) { struct ssi_aead_ctx *ctx = crypto_aead_ctx(tfm); - int rc = 0; + if (keylen < 3) return -EINVAL; @@ -659,9 +659,7 @@ static int ssi_rfc4309_ccm_setkey(struct crypto_aead *tfm, const u8 *key, unsign keylen -= 3; memcpy(ctx->ctr_nonce, key + keylen, 3); - rc = ssi_aead_setkey(tfm, key, keylen); - - return rc; + return ssi_aead_setkey(tfm, key, keylen); } #endif /*SSI_CC_HAS_AES_CCM*/ @@ -2214,7 +2212,7 @@ static int ssi_rfc4309_ccm_decrypt(struct aead_request *req) static int ssi_rfc4106_gcm_setkey(struct crypto_aead *tfm, const u8 *key, unsigned int keylen) { struct ssi_aead_ctx *ctx = crypto_aead_ctx(tfm); - int rc = 0; + SSI_LOG_DEBUG("%s() keylen %d, key %p\n", __func__, keylen, key); @@ -2224,15 +,13 @@ static int ssi_rfc4106_gcm_setkey(struct crypto_aead *tfm, const u8 *key, unsign keylen -= 4; memcpy(ctx->ctr_nonce, key + keylen, 4); - rc = ssi_aead_setkey(tfm, key, keylen); - - return rc; + return ssi_aead_setkey(tfm, key, keylen); } static int ssi_rfc4543_gcm_setkey(struct crypto_aead *tfm, const u8 *key, unsigned int keylen) { struct ssi_aead_ctx *ctx = crypto_aead_ctx(tfm); - int rc = 0; + SSI_LOG_DEBUG("%s() keylen %d, key %p\n", __func__, keylen, key); @@ -2242,9 +2238,7 @@ static int ssi_rfc4543_gcm_setkey(struct crypto_aead *tfm, const u8 *key, unsign keylen -= 4; memcpy(ctx->ctr_nonce, key + keylen, 4); - rc = ssi_aead_setkey(tfm, key, keylen); - - return rc; + return ssi_aead_setkey(tfm, key, keylen); } static int ssi_gcm_setauthsize(struct crypto_aead *authenc, -- 2.7.4
Re: [Outreachy kernel] [PATCH] Staging: ccree: Merge assignment with return
On Sat, Sep 9, 2017 at 1:42 AM, Julia Lawall <julia.law...@lip6.fr> wrote: > > > On Sat, 9 Sep 2017, Srishti Sharma wrote: > >> Return the return value of a function directly, instead of first saving it >> in a variable and then returning it. This change was made using the following > > Your commit message should respect the 80 character limit. The above is > one very long line. Yes, I'll fix it . Thanks > >> semantic patch by coccinelle. >> >> @@ >> local idexpression ret; >> expression e; >> @@ >> >> -ret = >> +return >> e; >> -return ret; >> >> Signed-off-by: Srishti Sharma <srishtis...@gmail.com> >> --- >> drivers/staging/ccree/ssi_aead.c | 21 ++--- >> 1 file changed, 6 insertions(+), 15 deletions(-) >> >> diff --git a/drivers/staging/ccree/ssi_aead.c >> b/drivers/staging/ccree/ssi_aead.c >> index 5abe6b2..6bb98f7 100644 >> --- a/drivers/staging/ccree/ssi_aead.c >> +++ b/drivers/staging/ccree/ssi_aead.c >> @@ -651,17 +651,14 @@ ssi_aead_setkey(struct crypto_aead *tfm, const u8 >> *key, unsigned int keylen) >> static int ssi_rfc4309_ccm_setkey(struct crypto_aead *tfm, const u8 *key, >> unsigned int keylen) >> { >> struct ssi_aead_ctx *ctx = crypto_aead_ctx(tfm); >> - int rc = 0; >> - >> + > > I'm not sure what happened here, but you should not be removing and then > adding back a blank line. Likewise below. Sorry , I must have removed an already existing blank line by mistake and must have re-added it upon realising the same. I'll fix these and send again. Regards, Srishti > > julia > >> if (keylen < 3) >> return -EINVAL; >> >> keylen -= 3; >> memcpy(ctx->ctr_nonce, key + keylen, 3); >> >> - rc = ssi_aead_setkey(tfm, key, keylen); >> - >> - return rc; >> + return ssi_aead_setkey(tfm, key, keylen); >> } >> #endif /*SSI_CC_HAS_AES_CCM*/ >> >> @@ -2214,8 +2211,7 @@ static int ssi_rfc4309_ccm_decrypt(struct aead_request >> *req) >> static int ssi_rfc4106_gcm_setkey(struct crypto_aead *tfm, const u8 *key, >> unsigned int keylen) >> { >> struct ssi_aead_ctx *ctx = crypto_aead_ctx(tfm); >> - int rc = 0; >> - >> + >> SSI_LOG_DEBUG("%s() keylen %d, key %p\n", __func__, keylen, key); >> >> if (keylen < 4) >> @@ -2224,16 +2220,13 @@ static int ssi_rfc4106_gcm_setkey(struct crypto_aead >> *tfm, const u8 *key, unsign >> keylen -= 4; >> memcpy(ctx->ctr_nonce, key + keylen, 4); >> >> - rc = ssi_aead_setkey(tfm, key, keylen); >> - >> - return rc; >> + return ssi_aead_setkey(tfm, key, keylen); >> } >> >> static int ssi_rfc4543_gcm_setkey(struct crypto_aead *tfm, const u8 *key, >> unsigned int keylen) >> { >> struct ssi_aead_ctx *ctx = crypto_aead_ctx(tfm); >> - int rc = 0; >> - >> + >> SSI_LOG_DEBUG("%s() keylen %d, key %p\n", __func__, keylen, key); >> >> if (keylen < 4) >> @@ -2242,9 +2235,7 @@ static int ssi_rfc4543_gcm_setkey(struct crypto_aead >> *tfm, const u8 *key, unsign >> keylen -= 4; >> memcpy(ctx->ctr_nonce, key + keylen, 4); >> >> - rc = ssi_aead_setkey(tfm, key, keylen); >> - >> - return rc; >> + return ssi_aead_setkey(tfm, key, keylen); >> } >> >> static int ssi_gcm_setauthsize(struct crypto_aead *authenc, >> -- >> 2.7.4 >> >> -- >> You received this message because you are subscribed to the Google Groups >> "outreachy-kernel" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to outreachy-kernel+unsubscr...@googlegroups.com. >> To post to this group, send email to outreachy-ker...@googlegroups.com. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/outreachy-kernel/1504900895-13110-1-git-send-email-srishtishar%40gmail.com. >> For more options, visit https://groups.google.com/d/optout. >>
[PATCH] Staging: ccree: Merge assignment with return
Return the return value of a function directly, instead of first saving it in a variable and then returning it. This change was made using the following semantic patch by coccinelle. @@ local idexpression ret; expression e; @@ -ret = +return e; -return ret; Signed-off-by: Srishti Sharma <srishtis...@gmail.com> --- drivers/staging/ccree/ssi_aead.c | 21 ++--- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/drivers/staging/ccree/ssi_aead.c b/drivers/staging/ccree/ssi_aead.c index 5abe6b2..6bb98f7 100644 --- a/drivers/staging/ccree/ssi_aead.c +++ b/drivers/staging/ccree/ssi_aead.c @@ -651,17 +651,14 @@ ssi_aead_setkey(struct crypto_aead *tfm, const u8 *key, unsigned int keylen) static int ssi_rfc4309_ccm_setkey(struct crypto_aead *tfm, const u8 *key, unsigned int keylen) { struct ssi_aead_ctx *ctx = crypto_aead_ctx(tfm); - int rc = 0; - + if (keylen < 3) return -EINVAL; keylen -= 3; memcpy(ctx->ctr_nonce, key + keylen, 3); - rc = ssi_aead_setkey(tfm, key, keylen); - - return rc; + return ssi_aead_setkey(tfm, key, keylen); } #endif /*SSI_CC_HAS_AES_CCM*/ @@ -2214,8 +2211,7 @@ static int ssi_rfc4309_ccm_decrypt(struct aead_request *req) static int ssi_rfc4106_gcm_setkey(struct crypto_aead *tfm, const u8 *key, unsigned int keylen) { struct ssi_aead_ctx *ctx = crypto_aead_ctx(tfm); - int rc = 0; - + SSI_LOG_DEBUG("%s() keylen %d, key %p\n", __func__, keylen, key); if (keylen < 4) @@ -2224,16 +2220,13 @@ static int ssi_rfc4106_gcm_setkey(struct crypto_aead *tfm, const u8 *key, unsign keylen -= 4; memcpy(ctx->ctr_nonce, key + keylen, 4); - rc = ssi_aead_setkey(tfm, key, keylen); - - return rc; + return ssi_aead_setkey(tfm, key, keylen); } static int ssi_rfc4543_gcm_setkey(struct crypto_aead *tfm, const u8 *key, unsigned int keylen) { struct ssi_aead_ctx *ctx = crypto_aead_ctx(tfm); - int rc = 0; - + SSI_LOG_DEBUG("%s() keylen %d, key %p\n", __func__, keylen, key); if (keylen < 4) @@ -2242,9 +2235,7 @@ static int ssi_rfc4543_gcm_setkey(struct crypto_aead *tfm, const u8 *key, unsign keylen -= 4; memcpy(ctx->ctr_nonce, key + keylen, 4); - rc = ssi_aead_setkey(tfm, key, keylen); - - return rc; + return ssi_aead_setkey(tfm, key, keylen); } static int ssi_gcm_setauthsize(struct crypto_aead *authenc, -- 2.7.4
[PATCH v2] Staging: ccree: Prefer using BIT macro.
Use BIT(x) instead of using (1<<x), reported by checkpatch.pl. Signed-off-by: Srishti Sharma <srishtis...@gmail.com> --- Changes in v2: - Add tab spaces before BIT macro. drivers/staging/ccree/ssi_cipher.h | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/ccree/ssi_cipher.h b/drivers/staging/ccree/ssi_cipher.h index 296b375..c9a83df 100644 --- a/drivers/staging/ccree/ssi_cipher.h +++ b/drivers/staging/ccree/ssi_cipher.h @@ -27,11 +27,11 @@ #include "ssi_buffer_mgr.h" /* Crypto cipher flags */ -#define CC_CRYPTO_CIPHER_KEY_KFDE0(1 << 0) -#define CC_CRYPTO_CIPHER_KEY_KFDE1(1 << 1) -#define CC_CRYPTO_CIPHER_KEY_KFDE2(1 << 2) -#define CC_CRYPTO_CIPHER_KEY_KFDE3(1 << 3) -#define CC_CRYPTO_CIPHER_DU_SIZE_512B (1 << 4) +#define CC_CRYPTO_CIPHER_KEY_KFDE0 BIT(0) +#define CC_CRYPTO_CIPHER_KEY_KFDE1 BIT(1) +#define CC_CRYPTO_CIPHER_KEY_KFDE2 BIT(2) +#define CC_CRYPTO_CIPHER_KEY_KFDE3 BIT(3) +#define CC_CRYPTO_CIPHER_DU_SIZE_512B BIT(4) #define CC_CRYPTO_CIPHER_KEY_KFDE_MASK (CC_CRYPTO_CIPHER_KEY_KFDE0 | CC_CRYPTO_CIPHER_KEY_KFDE1 | CC_CRYPTO_CIPHER_KEY_KFDE2 | CC_CRYPTO_CIPHER_KEY_KFDE3) -- 2.7.4
[PATCH] Staging: ccree: Prefer using BIT macro.
Use BIT(x) instead of (1<<x), reported by checkpatch.pl. Signed-off-by: Srishti Sharma <srishtis...@gmail.com> --- drivers/staging/ccree/ssi_cipher.h | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/ccree/ssi_cipher.h b/drivers/staging/ccree/ssi_cipher.h index 296b375..6fbcf9d 100644 --- a/drivers/staging/ccree/ssi_cipher.h +++ b/drivers/staging/ccree/ssi_cipher.h @@ -27,11 +27,11 @@ #include "ssi_buffer_mgr.h" /* Crypto cipher flags */ -#define CC_CRYPTO_CIPHER_KEY_KFDE0(1 << 0) -#define CC_CRYPTO_CIPHER_KEY_KFDE1(1 << 1) -#define CC_CRYPTO_CIPHER_KEY_KFDE2(1 << 2) -#define CC_CRYPTO_CIPHER_KEY_KFDE3(1 << 3) -#define CC_CRYPTO_CIPHER_DU_SIZE_512B (1 << 4) +#define CC_CRYPTO_CIPHER_KEY_KFDE0BIT(0) +#define CC_CRYPTO_CIPHER_KEY_KFDE1BIT(1) +#define CC_CRYPTO_CIPHER_KEY_KFDE2BIT(2) +#define CC_CRYPTO_CIPHER_KEY_KFDE3BIT(3) +#define CC_CRYPTO_CIPHER_DU_SIZE_512B BIT(4) #define CC_CRYPTO_CIPHER_KEY_KFDE_MASK (CC_CRYPTO_CIPHER_KEY_KFDE0 | CC_CRYPTO_CIPHER_KEY_KFDE1 | CC_CRYPTO_CIPHER_KEY_KFDE2 | CC_CRYPTO_CIPHER_KEY_KFDE3) -- 2.7.4
Re: [PATCH v5] Staging: ccree: Remove unused variable.
On Thu, Sep 7, 2017 at 2:20 PM, Gilad Ben-Yossef <gi...@benyossef.com> wrote: > Hi, > > On Thu, Sep 7, 2017 at 10:49 AM, Srishti Sharma <srishtis...@gmail.com> wrote: >> Remove the local variable inflight_counter as it is never used. >> >> Signed-off-by: Srishti Sharma <srishtis...@gmail.com> >> --- > > I've been meaning to clean that for some time now and never got around to do > it. > Thank you! :-) Glad to know :) > > Acked-by: Gilad Ben-Yossef <gi...@benyossef.com> > > >> Changes in v5: >> - Correct the format of the subject. >> drivers/staging/ccree/ssi_cipher.c | 3 --- >> 1 file changed, 3 deletions(-) >> >> diff --git a/drivers/staging/ccree/ssi_cipher.c >> b/drivers/staging/ccree/ssi_cipher.c >> index 8d31a93..1ff3c8a 100644 >> --- a/drivers/staging/ccree/ssi_cipher.c >> +++ b/drivers/staging/ccree/ssi_cipher.c >> @@ -697,13 +697,10 @@ static int ssi_blkcipher_complete(struct device *dev, >> void __iomem *cc_base) >> { >> int completion_error = 0; >> - u32 inflight_counter; >> struct ablkcipher_request *req = (struct ablkcipher_request *)areq; >> >> ssi_buffer_mgr_unmap_blkcipher_request(dev, req_ctx, ivsize, src, >> dst); >> >> - /*Set the inflight couter value to local variable*/ >> - inflight_counter = ctx_p->drvdata->inflight_counter; >> /*Decrease the inflight counter*/ >> if (ctx_p->flow_mode == BYPASS && ctx_p->drvdata->inflight_counter > >> 0) >> ctx_p->drvdata->inflight_counter--; >> -- >> 2.7.4 >> > > > > -- > 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 Regards, Srishti
[PATCH v5] Staging: ccree: Remove unused variable.
Remove the local variable inflight_counter as it is never used. Signed-off-by: Srishti Sharma <srishtis...@gmail.com> --- Changes in v5: - Correct the format of the subject. drivers/staging/ccree/ssi_cipher.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/staging/ccree/ssi_cipher.c b/drivers/staging/ccree/ssi_cipher.c index 8d31a93..1ff3c8a 100644 --- a/drivers/staging/ccree/ssi_cipher.c +++ b/drivers/staging/ccree/ssi_cipher.c @@ -697,13 +697,10 @@ static int ssi_blkcipher_complete(struct device *dev, void __iomem *cc_base) { int completion_error = 0; - u32 inflight_counter; struct ablkcipher_request *req = (struct ablkcipher_request *)areq; ssi_buffer_mgr_unmap_blkcipher_request(dev, req_ctx, ivsize, src, dst); - /*Set the inflight couter value to local variable*/ - inflight_counter = ctx_p->drvdata->inflight_counter; /*Decrease the inflight counter*/ if (ctx_p->flow_mode == BYPASS && ctx_p->drvdata->inflight_counter > 0) ctx_p->drvdata->inflight_counter--; -- 2.7.4
Re: [Outreachy kernel] [PATCH v4] Staging: ccree: ssi_cipher.c: Remove unused variable.
On Thu, Sep 7, 2017 at 12:24 PM, Julia Lawall <julia.law...@lip6.fr> wrote: > One last detail. The subject line above is not in the same format as that > of all of the other subject lines one commits affecting this file. You > can use git log --oneline to see what others have done. It is not really > possible to guess correctly. However, one does not generally include the > extension on a filename. > Yes, they have not used the filename in the subject line . So I'll change it to the required format . Thanks , Srishti > julia > > On Thu, 7 Sep 2017, Srishti Sharma wrote: > >> Remove local variable inflight_counter, as it is never used. >> >> Signed-off-by: Srishti Sharma <srishtis...@gmail.com> >> --- >> Change in v4: >> -There is no longer a need to make the comment more comprehensible, as I >> have deleted the variable associated with it. The v3 of this patch was >> not based on the original patch, hence v4. >> drivers/staging/ccree/ssi_cipher.c | 3 --- >> 1 file changed, 3 deletions(-) >> >> diff --git a/drivers/staging/ccree/ssi_cipher.c >> b/drivers/staging/ccree/ssi_cipher.c >> index 8d31a93..1ff3c8a 100644 >> --- a/drivers/staging/ccree/ssi_cipher.c >> +++ b/drivers/staging/ccree/ssi_cipher.c >> @@ -697,13 +697,10 @@ static int ssi_blkcipher_complete(struct device *dev, >> void __iomem *cc_base) >> { >> int completion_error = 0; >> - u32 inflight_counter; >> struct ablkcipher_request *req = (struct ablkcipher_request *)areq; >> >> ssi_buffer_mgr_unmap_blkcipher_request(dev, req_ctx, ivsize, src, dst); >> >> - /*Set the inflight couter value to local variable*/ >> - inflight_counter = ctx_p->drvdata->inflight_counter; >> /*Decrease the inflight counter*/ >> if (ctx_p->flow_mode == BYPASS && ctx_p->drvdata->inflight_counter > 0) >> ctx_p->drvdata->inflight_counter--; >> -- >> 2.7.4 >> >> -- >> You received this message because you are subscribed to the Google Groups >> "outreachy-kernel" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to outreachy-kernel+unsubscr...@googlegroups.com. >> To post to this group, send email to outreachy-ker...@googlegroups.com. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/outreachy-kernel/1504735553-13753-1-git-send-email-srishtishar%40gmail.com. >> For more options, visit https://groups.google.com/d/optout. >>
[PATCH v4] Staging: ccree: ssi_cipher.c: Remove unused variable.
Remove local variable inflight_counter, as it is never used. Signed-off-by: Srishti Sharma <srishtis...@gmail.com> --- Change in v4: -There is no longer a need to make the comment more comprehensible, as I have deleted the variable associated with it. The v3 of this patch was not based on the original patch, hence v4. drivers/staging/ccree/ssi_cipher.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/staging/ccree/ssi_cipher.c b/drivers/staging/ccree/ssi_cipher.c index 8d31a93..1ff3c8a 100644 --- a/drivers/staging/ccree/ssi_cipher.c +++ b/drivers/staging/ccree/ssi_cipher.c @@ -697,13 +697,10 @@ static int ssi_blkcipher_complete(struct device *dev, void __iomem *cc_base) { int completion_error = 0; - u32 inflight_counter; struct ablkcipher_request *req = (struct ablkcipher_request *)areq; ssi_buffer_mgr_unmap_blkcipher_request(dev, req_ctx, ivsize, src, dst); - /*Set the inflight couter value to local variable*/ - inflight_counter = ctx_p->drvdata->inflight_counter; /*Decrease the inflight counter*/ if (ctx_p->flow_mode == BYPASS && ctx_p->drvdata->inflight_counter > 0) ctx_p->drvdata->inflight_counter--; -- 2.7.4
Re: [PATCH v3] Staging: ccree: ssi_cipher.c: Remove unused variable.
On Thu, Sep 7, 2017 at 3:02 AM, Dan Carpenterwrote: > Always compile your patches. > > CC [M] drivers/staging/ccree/ssi_cipher.o > drivers/staging/ccree/ssi_cipher.c: In function ‘ssi_blkcipher_complete’: > drivers/staging/ccree/ssi_cipher.c:700:6: warning: unused variable > ‘inflight_counter’ [-Wunused-variable] > u32 inflight_counter; > ^~~~ > > You need to delete the declaration as well. > > Don't be in a rush to resend patches. I normally write them then let > them sit in my outbox overnight and send them in the morning. The extra > delay helps me to calm down a bit and focus better. Even though I've > sent thousands of patches, it sometimes still stresses me out. It's > like you're disagreeing with the original author and the reviewers are > disagreeing with you and everyone's trying to be nice about it but > patches are fundamentally points of disagreement and that's stress. > > regards, > dan carpenter > Thanks , I'll be more careful ! Regards, Srishti
Re: [Outreachy kernel] [PATCH v3] Staging: ccree: ssi_cipher.c: Remove unused variable.
On Thu, Sep 7, 2017 at 2:56 AM, Julia Lawall <julia.law...@lip6.fr> wrote: > > > On Thu, 7 Sep 2017, Srishti Sharma wrote: > >> On Thu, Sep 7, 2017 at 2:47 AM, Julia Lawall <julia.law...@lip6.fr> wrote: >> > >> > >> > On Thu, 7 Sep 2017, Srishti Sharma wrote: >> > >> >> Remove local variable inflight_counter ,as it is never used. >> > >> > "counter ,as" -> "counter, as" >> > >> >> Signed-off-by: Srishti Sharma <srishtis...@gmail.com> >> >> --- >> >> Changes in v3: >> >> - There was no longer a need to make the comment more comprehensible as >> >>I have deleted the variable associated with it because it is unused . >> >> drivers/staging/ccree/ssi_cipher.c | 5 + >> >> 1 file changed, 1 insertion(+), 4 deletions(-) >> >> >> >> diff --git a/drivers/staging/ccree/ssi_cipher.c >> >> b/drivers/staging/ccree/ssi_cipher.c >> >> index fec2faa..609ebe4 100644 >> >> --- a/drivers/staging/ccree/ssi_cipher.c >> >> +++ b/drivers/staging/ccree/ssi_cipher.c >> >> @@ -702,10 +702,7 @@ static int ssi_blkcipher_complete(struct device *dev, >> >> >> >> ssi_buffer_mgr_unmap_blkcipher_request(dev, req_ctx, ivsize, src, >> >> dst); >> >> >> >> - /* >> >> - * Save inflight_counter in a local variable. >> >> - */ >> >> - inflight_counter = ctx_p->drvdata->inflight_counter; >> >> + >> > >> > This is a patch on your previous patch. It should be a patch on the >> > original code. Also, don't add a new blank line. Just remove the line >> > completely. >> >> so , when I resend it should I version it as v3 or send as a new >> patch as it is now fixing a different problem ? > > v3 (or maybe now v4?) would be fine. It's still the same code that is > under consideration. Then it will be clear that he previosu patches are > not needed. Okay , Thanks ! Regards, Srishti > > julia > >> Regards, >> Srishti >> > >> > julia >> > >> >> /*Decrease the inflight counter*/ >> >> if (ctx_p->flow_mode == BYPASS && ctx_p->drvdata->inflight_counter >> >> > 0) >> >> ctx_p->drvdata->inflight_counter--; >> >> -- >> >> 2.7.4 >> >> >> >> -- >> >> You received this message because you are subscribed to the Google Groups >> >> "outreachy-kernel" group. >> >> To unsubscribe from this group and stop receiving emails from it, send an >> >> email to outreachy-kernel+unsubscr...@googlegroups.com. >> >> To post to this group, send email to outreachy-ker...@googlegroups.com. >> >> To view this discussion on the web visit >> >> https://groups.google.com/d/msgid/outreachy-kernel/1504732426-9765-1-git-send-email-srishtishar%40gmail.com. >> >> For more options, visit https://groups.google.com/d/optout. >> >> >>
Re: [Outreachy kernel] [PATCH v3] Staging: ccree: ssi_cipher.c: Remove unused variable.
On Thu, Sep 7, 2017 at 2:47 AM, Julia Lawall <julia.law...@lip6.fr> wrote: > > > On Thu, 7 Sep 2017, Srishti Sharma wrote: > >> Remove local variable inflight_counter ,as it is never used. > > "counter ,as" -> "counter, as" > >> Signed-off-by: Srishti Sharma <srishtis...@gmail.com> >> --- >> Changes in v3: >> - There was no longer a need to make the comment more comprehensible as >>I have deleted the variable associated with it because it is unused . >> drivers/staging/ccree/ssi_cipher.c | 5 + >> 1 file changed, 1 insertion(+), 4 deletions(-) >> >> diff --git a/drivers/staging/ccree/ssi_cipher.c >> b/drivers/staging/ccree/ssi_cipher.c >> index fec2faa..609ebe4 100644 >> --- a/drivers/staging/ccree/ssi_cipher.c >> +++ b/drivers/staging/ccree/ssi_cipher.c >> @@ -702,10 +702,7 @@ static int ssi_blkcipher_complete(struct device *dev, >> >> ssi_buffer_mgr_unmap_blkcipher_request(dev, req_ctx, ivsize, src, dst); >> >> - /* >> - * Save inflight_counter in a local variable. >> - */ >> - inflight_counter = ctx_p->drvdata->inflight_counter; >> + > > This is a patch on your previous patch. It should be a patch on the > original code. Also, don't add a new blank line. Just remove the line > completely. so , when I resend it should I version it as v3 or send as a new patch as it is now fixing a different problem ? Regards, Srishti > > julia > >> /*Decrease the inflight counter*/ >> if (ctx_p->flow_mode == BYPASS && ctx_p->drvdata->inflight_counter > 0) >> ctx_p->drvdata->inflight_counter--; >> -- >> 2.7.4 >> >> -- >> You received this message because you are subscribed to the Google Groups >> "outreachy-kernel" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to outreachy-kernel+unsubscr...@googlegroups.com. >> To post to this group, send email to outreachy-ker...@googlegroups.com. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/outreachy-kernel/1504732426-9765-1-git-send-email-srishtishar%40gmail.com. >> For more options, visit https://groups.google.com/d/optout. >>
[PATCH v3] Staging: ccree: ssi_cipher.c: Remove unused variable.
Remove local variable inflight_counter ,as it is never used. Signed-off-by: Srishti Sharma <srishtis...@gmail.com> --- Changes in v3: - There was no longer a need to make the comment more comprehensible as I have deleted the variable associated with it because it is unused . drivers/staging/ccree/ssi_cipher.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/staging/ccree/ssi_cipher.c b/drivers/staging/ccree/ssi_cipher.c index fec2faa..609ebe4 100644 --- a/drivers/staging/ccree/ssi_cipher.c +++ b/drivers/staging/ccree/ssi_cipher.c @@ -702,10 +702,7 @@ static int ssi_blkcipher_complete(struct device *dev, ssi_buffer_mgr_unmap_blkcipher_request(dev, req_ctx, ivsize, src, dst); - /* -* Save inflight_counter in a local variable. -*/ - inflight_counter = ctx_p->drvdata->inflight_counter; + /*Decrease the inflight counter*/ if (ctx_p->flow_mode == BYPASS && ctx_p->drvdata->inflight_counter > 0) ctx_p->drvdata->inflight_counter--; -- 2.7.4
Re: [Outreachy kernel] [PATCH v2] Staging: ccree: ssi_cipher.c: Make comment more comprehensible.
On Thu, Sep 7, 2017 at 2:28 AM, Julia Lawall <julia.law...@lip6.fr> wrote: > > > On Thu, 7 Sep 2017, Srishti Sharma wrote: > >> Edited comment to make it more comprehensible. >> >> Signed-off-by: Srishti Sharma <srishtis...@gmail.com> >> --- >> Changes in v2: >> - Make comment more comprehensible , instead of just correcting typos. >> drivers/staging/ccree/ssi_cipher.c | 4 +++- >> 1 file changed, 3 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/staging/ccree/ssi_cipher.c >> b/drivers/staging/ccree/ssi_cipher.c >> index 99232b2..fec2faa 100644 >> --- a/drivers/staging/ccree/ssi_cipher.c >> +++ b/drivers/staging/ccree/ssi_cipher.c >> @@ -702,7 +702,9 @@ static int ssi_blkcipher_complete(struct device *dev, >> >> ssi_buffer_mgr_unmap_blkcipher_request(dev, req_ctx, ivsize, src, dst); >> >> - /*Set the inflight counter value to local variable*/ >> + /* >> + * Save inflight_counter in a local variable. >> + */ > > This is the format for multiline comments. Your comments is only one > line. You just need to add spaces around the text, as compared to the > original version. > > julia > >> inflight_counter = ctx_p->drvdata->inflight_counter; >> /*Decrease the inflight counter*/ >> if (ctx_p->flow_mode == BYPASS && ctx_p->drvdata->inflight_counter > 0) >> -- >> 2.7.4 >> >> -- >> You received this message because you are subscribed to the Google Groups >> "outreachy-kernel" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to outreachy-kernel+unsubscr...@googlegroups.com. >> To post to this group, send email to outreachy-ker...@googlegroups.com. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/outreachy-kernel/1504731390-9536-1-git-send-email-srishtishar%40gmail.com. >> For more options, visit https://groups.google.com/d/optout. >> Okay, Thanks I'll re-send it . Regards, Srishti
[PATCH] Staging: ccree: ssi_cipher.c: Correct spelling mistake.
Correct spelling of counter in comment . Signed-off-by: Srishti Sharma <srishtis...@gmail.com> --- drivers/staging/ccree/ssi_cipher.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/ccree/ssi_cipher.c b/drivers/staging/ccree/ssi_cipher.c index 8d31a93..99232b2 100644 --- a/drivers/staging/ccree/ssi_cipher.c +++ b/drivers/staging/ccree/ssi_cipher.c @@ -702,7 +702,7 @@ static int ssi_blkcipher_complete(struct device *dev, ssi_buffer_mgr_unmap_blkcipher_request(dev, req_ctx, ivsize, src, dst); - /*Set the inflight couter value to local variable*/ + /*Set the inflight counter value to local variable*/ inflight_counter = ctx_p->drvdata->inflight_counter; /*Decrease the inflight counter*/ if (ctx_p->flow_mode == BYPASS && ctx_p->drvdata->inflight_counter > 0) -- 2.7.4
Re: [PATCH 1/4] Staging: ccree: cc_crypto_ctx.h: Added * on subsequent lines of a comment block.
On Sun, Jun 4, 2017 at 1:49 PM, Greg KH <gre...@linuxfoundation.org> wrote: > On Sun, Jun 04, 2017 at 05:02:08AM +0530, srishti sharma wrote: >> Added * on subsequent lines of a comment block. >> >> Signed-off-by: srishti sharma <srishtis...@gmail.com> >> --- >> drivers/staging/ccree/cc_crypto_ctx.h | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) > > This whole series also does not apply. Note, this driver is under > active development, you are probably running into the problem that lots > of people are working on it at the same time. > > sorry, > > greg k-h Okay , Thanks a lot ! Regards, Srishti
[PATCH 4/4] Staging: ccree: cc_crypto_ctx.h: Added * on subsequent lines of a comment block
Added *'s on subsequent lines of a comment block to fix coding style issues. Signed-off-by: srishti sharma <srishtis...@gmail.com> --- drivers/staging/ccree/cc_crypto_ctx.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/ccree/cc_crypto_ctx.h b/drivers/staging/ccree/cc_crypto_ctx.h index 03164624..a8747d5 100644 --- a/drivers/staging/ccree/cc_crypto_ctx.h +++ b/drivers/staging/ccree/cc_crypto_ctx.h @@ -281,9 +281,9 @@ struct drv_ctx_aead { /* Get the address of a @member within a given @ctx address - @ctx: The context address - @type: Type of context structure - @member: Associated context field */ + * @ctx: The context address + * @type: Type of context structure + * @member: Associated context field */ #define GET_CTX_FIELD_ADDR(ctx, type, member) (ctx + offsetof(type, member)) #endif /* _CC_CRYPTO_CTX_H_ */ -- 2.7.4
[PATCH 3/4] Staging: ccree: cc_crypto_ctx.h: Fixed * alignment issues in a comment block
Fixed the alignment of * in a comment block. Signed-off-by: srishti sharma <srishtis...@gmail.com> --- drivers/staging/ccree/cc_crypto_ctx.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/ccree/cc_crypto_ctx.h b/drivers/staging/ccree/cc_crypto_ctx.h index 27a5914..03164624 100644 --- a/drivers/staging/ccree/cc_crypto_ctx.h +++ b/drivers/staging/ccree/cc_crypto_ctx.h @@ -242,9 +242,9 @@ struct drv_ctx_cipher { u32 key_size; /* numeric value in bytes */ u32 data_unit_size; /* required for XTS */ /* block_state is the AES engine block state. - * It is used by the host to pass IV or counter at initialization. - * It is used by SeP for intermediate block chaining state and for - * returning MAC algorithms results. */ +* It is used by the host to pass IV or counter at initialization. +* It is used by SeP for intermediate block chaining state and for +* returning MAC algorithms results. */ u8 block_state[CC_AES_BLOCK_SIZE]; u8 key[CC_AES_KEY_SIZE_MAX]; u8 xex_key[CC_AES_KEY_SIZE_MAX]; -- 2.7.4
[PATCH 2/4] Staging: ccree: cc_crypto_ctx.h: Fixed trailing */ issue in a comment block
Fixed trailing */ style issue in a block comment. Signed-off-by: srishti sharma <srishtis...@gmail.com> --- drivers/staging/ccree/cc_crypto_ctx.h | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/staging/ccree/cc_crypto_ctx.h b/drivers/staging/ccree/cc_crypto_ctx.h index 6ee51b8..27a5914 100644 --- a/drivers/staging/ccree/cc_crypto_ctx.h +++ b/drivers/staging/ccree/cc_crypto_ctx.h @@ -218,8 +218,10 @@ struct drv_ctx_hash { CC_DIGEST_SIZE_MAX]; }; -/* drv_ctx_hmac should have the same structure as drv_ctx_hash except - * k0, k0_size fields */ +/* + * drv_ctx_hmac should have the same structure as drv_ctx_hash except + * k0, k0_size fields + */ struct drv_ctx_hmac { enum drv_crypto_alg alg; /* DRV_CRYPTO_ALG_HMAC */ enum drv_hash_mode mode; @@ -285,4 +287,3 @@ struct drv_ctx_aead { #define GET_CTX_FIELD_ADDR(ctx, type, member) (ctx + offsetof(type, member)) #endif /* _CC_CRYPTO_CTX_H_ */ - -- 2.7.4
[PATCH 1/4] Staging: ccree: cc_crypto_ctx.h: Added * on subsequent lines of a comment block.
Added * on subsequent lines of a comment block. Signed-off-by: srishti sharma <srishtis...@gmail.com> --- drivers/staging/ccree/cc_crypto_ctx.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/ccree/cc_crypto_ctx.h b/drivers/staging/ccree/cc_crypto_ctx.h index ac39d34..6ee51b8 100644 --- a/drivers/staging/ccree/cc_crypto_ctx.h +++ b/drivers/staging/ccree/cc_crypto_ctx.h @@ -219,7 +219,7 @@ struct drv_ctx_hash { }; /* drv_ctx_hmac should have the same structure as drv_ctx_hash except - k0, k0_size fields */ + * k0, k0_size fields */ struct drv_ctx_hmac { enum drv_crypto_alg alg; /* DRV_CRYPTO_ALG_HMAC */ enum drv_hash_mode mode; -- 2.7.4
[PATCH 0/4] Fixed comment coding style issues.
This patchset contains a series of comment coding style issues fixes. srishti sharma (4): Staging: ccree: cc_crypto_ctx.h: Added * on subsequent lines of a comment block. Staging: ccree: cc_crypto_ctx.h: Fixed trailing */ issue in a comment block Staging: ccree: cc_crypto_ctx.h: Fixed * alignment issues in a comment block Staging: ccree: cc_crypto_ctx.h: Added * on subsequent lines of a comment block drivers/staging/ccree/cc_crypto_ctx.h | 19 ++- 1 file changed, 10 insertions(+), 9 deletions(-) -- 2.7.4
Re: [PATCH] Staging: ccree: ssi_aead.h: Fixed a pointer declaration error.
Hey, checkpatch.pl generated two errors , because the dereferencing operator was placed next to the structure name instead of being placed with the pointer . for eg: struct scatterlist* srcSgl; (this was giving an error) whereas struct scatterlist *srcSgl; (this did not give an error) Both of them will compile , but the second one is a better representation of it and does not produce an error on running checkpatch.pl . Regards, Srishti On Sat, Jun 3, 2017 at 2:07 PM, Greg KH <gre...@linuxfoundation.org> wrote: > On Sat, Jun 03, 2017 at 04:15:17AM +0530, srishti sharma wrote: >> Fixed a pointer declaration error , the dereferencing operator was misplaced. > > Odd use of a , > > Also, I don't understand what was "misplaced" here? There does not seem > to be a "error" fixed here... >
[PATCH] Staging: ccree: ssi_aead.h: Fixed a comment coding style issue.
Fixed a comment coding style issue , block comments use * on subsequent lines. Signed-off-by: srishti sharma <srishtis...@gmail.com> --- drivers/staging/ccree/ssi_aead.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/staging/ccree/ssi_aead.h b/drivers/staging/ccree/ssi_aead.h index 9cf5225..4b592b7 100644 --- a/drivers/staging/ccree/ssi_aead.h +++ b/drivers/staging/ccree/ssi_aead.h @@ -14,8 +14,9 @@ * along with this program; if not, see <http://www.gnu.org/licenses/>. */ -/* \file ssi_aead.h - ARM CryptoCell AEAD Crypto API +/* + * \file ssi_aead.h + * ARM CryptoCell AEAD Crypto API */ #ifndef __SSI_AEAD_H__ -- 2.7.4
[PATCH] Staging: ccree: ssi_aead.h: Fixed a pointer declaration error.
Fixed a pointer declaration error , the dereferencing operator was misplaced. Signed-off-by: srishti sharma <srishtis...@gmail.com> --- drivers/staging/ccree/ssi_aead.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/ccree/ssi_aead.h b/drivers/staging/ccree/ssi_aead.h index 654a181..9cf5225 100644 --- a/drivers/staging/ccree/ssi_aead.h +++ b/drivers/staging/ccree/ssi_aead.h @@ -97,8 +97,8 @@ struct aead_req_ctx { struct ssi_mlli assoc; struct ssi_mlli src; struct ssi_mlli dst; - struct scatterlist* srcSgl; - struct scatterlist* dstSgl; + struct scatterlist *srcSgl; + struct scatterlist *dstSgl; unsigned int srcOffset; unsigned int dstOffset; enum ssi_req_dma_buf_type assoc_buff_type; -- 2.7.4
[PATCH] Staging: ccree: cc_crypto_ctx.h: Fixed a comment coding style issue.
Fixed a comment coding style issue that generated a warning stating that block comments should align the * on each line. Signed-off-by: srishti sharma <srishtis...@gmail.com> --- drivers/staging/ccree/cc_crypto_ctx.h | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/ccree/cc_crypto_ctx.h b/drivers/staging/ccree/cc_crypto_ctx.h index c5784bc..38f6615 100644 --- a/drivers/staging/ccree/cc_crypto_ctx.h +++ b/drivers/staging/ccree/cc_crypto_ctx.h @@ -239,10 +239,10 @@ struct drv_ctx_cipher { enum drv_crypto_padding_type padding_type; u32 key_size; /* numeric value in bytes */ u32 data_unit_size; /* required for XTS */ - /* block_state is the AES engine block state. - * It is used by the host to pass IV or counter at initialization. - * It is used by SeP for intermediate block chaining state and for - * returning MAC algorithms results. */ + /* block_state is the AES engine block state. +* It is used by the host to pass IV or counter at initialization. +* It is used by SeP for intermediate block chaining state and for +* returning MAC algorithms results. */ u8 block_state[CC_AES_BLOCK_SIZE]; u8 key[CC_AES_KEY_SIZE_MAX]; u8 xex_key[CC_AES_KEY_SIZE_MAX]; 2.7.4
[PATCH] Staging: ccree: cc_crypto_ctx.h: Fixed a comment coding style issue.
Fixed a comment coding style issue that generated a warning stating block comments use * on subsequent lines. Signed-off-by: srishti sharma <srishtis...@gmail.com> --- drivers/staging/ccree/cc_crypto_ctx.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/ccree/cc_crypto_ctx.h b/drivers/staging/ccree/cc_crypto_ctx.h index ac39d34..c5784bc 100644 --- a/drivers/staging/ccree/cc_crypto_ctx.h +++ b/drivers/staging/ccree/cc_crypto_ctx.h @@ -279,9 +279,9 @@ struct drv_ctx_aead { /* Get the address of a @member within a given @ctx address - @ctx: The context address - @type: Type of context structure - @member: Associated context field */ + * @ctx: The context address + * @type: Type of context structure + * @member: Associated context field */ #define GET_CTX_FIELD_ADDR(ctx, type, member) (ctx + offsetof(type, member)) #endif /* _CC_CRYPTO_CTX_H_ */ 2.7.4