staging: wlan-ng: remove unnecessary kfree statements
PATCH 1/2 staging: wlan-ng: remove unnecessary kfree statements
The function uses goto free_result in rest of its implementation.
--- drivers/staging/wlan-ng/prism2fw.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/staging/wlan-ng/prism2fw.c +2 -3
@@ -1008,12 +1008,11 @@ static int writeimage(struct wlandevice *wlandev, struct imgchunk *fchunk, rstmsg =kzalloc (sizeof (*rstmsg),GFP_KERNEL ); rwrmsg =kzalloc (sizeof (*rwrmsg),GFP_KERNEL );if (!rstmsg || !rwrmsg) { -kfree (rstmsg); -kfree (rwrmsg);netdev_err (wlandev->netdev,"%s: no memory for firmware download, aborting download\n" , __func__); -return -ENOMEM ; + result = -ENOMEM ; + goto free_result; }/* Initialize the messages */
Signature · 1 line
2.34.1
PATCH 2/2 staging: wlan-ng: remove else statement
else block is not needed if j is set to -1
before if block
--- drivers/staging/wlan-ng/prism2fw.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/staging/wlan-ng/prism2fw.c +1 -2
@@ -689,6 +689,7 @@ static int plugimage(struct imgchunk *fchunk, unsigned int nfchunks,for (i =0 ; i < ns3plug; i++) { pstart = s3plug[i].addr; pend = s3plug[i].addr + s3plug[i].len; + j =-1 ;/* find the matching PDR (or filename) */ if (s3plug[i].itemcode !=0xffffffffUL ) {/* not filename */ for (j =0 ; j < pda->nrec; j++) {
@@ -696,8 +697,6 @@ static int plugimage(struct imgchunk *fchunk, unsigned int nfchunks, le16_to_cpu(pda->rec[j]->code))break ; } - }else { - j =-1 ; }if (j >= pda->nrec && j !=-1 ) {/* if no matching PDR, fail */ pr_warn("warning: Failed to find PDR for plugrec 0x%04x.\n",
Signature · 1 line
2.34.1
Re: [PATCH 2/2] staging: wlan-ng: remove else statement
Quoted 5 lines · Archana
else block is not needed if j is set to -1
before if blockSigned-off-by Archana <[email protected]>---
Is Archana your full legal name that you would write on a legal document?
I feel like the patch is nice and I like that it's based on reading the code instead of checkpatch. The commit message isn't great. Here is my suggestion on that:
Subject: [PATCH 2/2] staging: wlan-ng: small clean up in plugimage()
It's cleaner to set "j = -1;" before the if block and remove the else statement.
The main differences are:
1: It says that the motivation for the patch is a clean up. 2: Capital letter at the start of the sentence.
3: Period at the end.
I try not to be too picky about commit messages but the issue with your legal name is important so you were going to have to resend anyway. Also everyone can use capital letters and periods even if English is not their first language. We could figure out the motivation for the patch easily enough but we like to be extra strict with new people so they develop good habbits.
regards,
dan carpenter
Re: [PATCH 2/2] staging: wlan-ng: remove else statement
Quoted 8 lines · Dan Carpenter
Quoted 5 lines · Archana
else block is not needed if j is set to -1
before if blockSigned-off-by Archana <[email protected]>---
Is Archana your full legal name that you would write on a legal document?
Ah, never mind. Apparently this policy has been updated. Pseudonyms are allowed for people concerned about privacy but anonymous contributions are not allowed.
https://lore.kernel.org/all/ZAoMxSPKNLoLg7Wl@aschofie-mobl2/
regards,
dan carpenter
Greg KH
maintainerRe: [PATCH 2/2] staging: wlan-ng: remove else statement
Quoted 8 lines · Dan Carpenter
Quoted 7 lines · Dan Carpenter
Quoted 5 lines · Archana
else block is not needed if j is set to -1
before if blockSigned-off-by Archana <[email protected]>---
Quoted 7 lines
Quoted 1 line
Is Archana your full legal name that you would write on a legal document?
Ah, never mind. Apparently this policy has been updated. Pseudonyms are allowed for people concerned about privacy but anonymous contributions are not allowed.
https://lore.kernel.org/all/ZAoMxSPKNLoLg7Wl@aschofie-mobl2/
That being said, I still have to ask this same question anyway, so it's ok to ask this.
thanks,
greg k-h
PATCH v2 1/2 staging: wlan-ng: small cleanup in writeimage()
It is cleaner to use "goto free_result;" as is being followed in rest of the implementation of writeimage function, and remove unnecessary kfree statements.
---
Changes in v2:
- Make the commit message more clearer.
drivers/staging/wlan-ng/prism2fw.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/staging/wlan-ng/prism2fw.c +2 -3
@@ -1008,12 +1008,11 @@ static int writeimage(struct wlandevice *wlandev, struct imgchunk *fchunk, rstmsg =kzalloc (sizeof (*rstmsg),GFP_KERNEL ); rwrmsg =kzalloc (sizeof (*rwrmsg),GFP_KERNEL );if (!rstmsg || !rwrmsg) { -kfree (rstmsg); -kfree (rwrmsg);netdev_err (wlandev->netdev,"%s: no memory for firmware download, aborting download\n" , __func__); -return -ENOMEM ; + result = -ENOMEM ; + goto free_result; }/* Initialize the messages */
Signature · 1 line
2.34.1
PATCH v2 2/2 staging: wlan-ng: small cleanup in plugimage()
It's cleaner to set "j = -1;" before the if block and remove the else statement.
---
Changes in v2:
- Make the commit message more clearer.
drivers/staging/wlan-ng/prism2fw.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/staging/wlan-ng/prism2fw.c +1 -2
@@ -689,6 +689,7 @@ static int plugimage(struct imgchunk *fchunk, unsigned int nfchunks,for (i =0 ; i < ns3plug; i++) { pstart = s3plug[i].addr; pend = s3plug[i].addr + s3plug[i].len; + j =-1 ;/* find the matching PDR (or filename) */ if (s3plug[i].itemcode !=0xffffffffUL ) {/* not filename */ for (j =0 ; j < pda->nrec; j++) {
@@ -696,8 +697,6 @@ static int plugimage(struct imgchunk *fchunk, unsigned int nfchunks, le16_to_cpu(pda->rec[j]->code))break ; } - }else { - j =-1 ; }if (j >= pda->nrec && j !=-1 ) {/* if no matching PDR, fail */ pr_warn("warning: Failed to find PDR for plugrec 0x%04x.\n",
Signature · 1 line
2.34.1
Re: [PATCH v2 1/2] staging: wlan-ng: small cleanup in writeimage()
In reply to ArchanaQuoted 8 lines · Archana
It is cleaner to use "goto
free_result;" as is being followed in rest of the implementation of writeimage function, and remove unnecessary kfree statements.Signed-off-by Archana <[email protected]>---
Changes in v2:
- Make the commit message more clearer.
Thanks. Both look good to me now.
regards,
dan carpenter
Re: [PATCH 2/2] staging: wlan-ng: remove else statement
In reply to Greg KHQuoted 10 lines · Greg KH
Quoted 9 lines · Dan Carpenter
Quoted 8 lines · Dan Carpenter
Quoted 5 lines · Archana
else block is not needed if j is set to -1
before if blockSigned-off-by Archana <[email protected]>---
Is Archana your full legal name that you would write on a legal document?
Yes, Archana is my full legal name.
Thank you for your feedbacks.
I have sent revised patch.
Regards,
Archana
Greg KH
maintainerQuoted 30 lines · Archana
The function uses goto
free_resultin rest of its implementation.Signed-off-by Archana <[email protected]>--- drivers/staging/wlan-ng/prism2fw.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)drivers/staging/wlan-ng/prism2fw.c +2
-3@@ -1008,12 +1008,11 @@ static int writeimage(struct wlandevice *wlandev, struct imgchunk *fchunk, rstmsg =kzalloc (sizeof (*rstmsg),GFP_KERNEL ); rwrmsg =kzalloc (sizeof (*rwrmsg),GFP_KERNEL );if (!rstmsg || !rwrmsg) { -kfree (rstmsg); -kfree (rwrmsg);netdev_err (wlandev->netdev,"%s: no memory for firmware download, aborting download\n" , __func__); -return -ENOMEM ; + result = -ENOMEM ; + goto free_result; }/* Initialize the messages */ Signature · 1 line
2.34.1
Hi,
This is the friendly patch-bot of Greg Kroah-Hartman. You have sent him a patch that has triggered this response. He used to manually respond to these common problems, but in order to save his sanity (he kept writing the same thing over and over, yet to different people), I was created. Hopefully you will not take offence and will fix the problem in your patch and resubmit it so that it can be accepted into the Linux kernel tree.
You are receiving this message because of the following common error(s) as indicated below:
- You did not specify a description of why the patch is needed, or possibly, any description at all, in the email body. Please read the section entitled "The canonical patch format" in the kernel file, Documentation/process/submitting-patches.rst for what is needed in order to properly describe the change.
- It looks like you did not use your "real" name for the patch on either the Signed-off-by: line, or the From: line (both of which have to match). Please read the kernel file, Documentation/process/submitting-patches.rst for how to do this correctly.
If you wish to discuss this problem further, or you have questions about how to resolve this issue, please feel free to respond to this email and Greg will reply once he has dug out from the pending patches received from other developers.
thanks,
greg k-h's patch email bot
Hey,
- I am not sure why i am getting the description error. I had sent a v2 patch version on which i haven't received this review.
- My real name is Archana.
Can you please guide me on what is required from my end to close this patch?
Thanks,
Archana
Please ignore the previous message.
This patch is closed.
Thanks,
Archana