Skip to contentSkip to conversation

Fixing check patch styling issues

PATCH Superseded Raghu H 6 participants 14 messages Apr 28, 2023 – May 8, 2023 CXL

v2 of 7 Superseded Latest is v7 →

lore
Share & tools
lore

Raghu H

author
#0 lore raw

v2 cover Fixing check patch styling issues

v2 changes:
Thanks Alison, Ira for your comments, modified the v1 patches as suggested. Dropped the patch containing tab changes in port.c

v1 cover letter:
The following patches are cleanup or fixing the styling issues found using checkpatch

In cxl/core/mbox.c, in case of null check failure, returning errno or -ENOMEM in this case is good enough, removing the redundant dev_err message.

In cxl/core/region.c, the else is not required after the return statement, cleaned it up.

Verified the build and sanity by booting the guest VM using the freshly built components.

Raghu H (2):
cxl/mbox: Remove redundant dev_err() after failed mem alloc cxl/region: Remove else after return statement

 drivers/cxl/core/mbox.c   | 4 +---
 drivers/cxl/core/region.c | 8 ++++----
 2 files changed, 5 insertions(+), 7 deletions(-)
Signature · 1 line
2.39.2
author
#1 lore raw

PATCH v2 1/2 cxl/mbox: Remove redundant dev_err() after failed mem alloc

Issue found with checkpatch

A return of errno should be good enough if the memory allocation fails, the error message here is redundatant as per the coding style, removing it.

---
 drivers/cxl/core/mbox.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/cxl/core/mbox.c +1 -3
index f2addb457172..11ea145b4b1f 100644
@@ -1112,10 +1112,8 @@ struct cxl_dev_state *cxl_dev_state_create(struct device *dev)
 	struct cxl_dev_state *cxlds;
 
 	cxlds = devm_kzalloc(dev, sizeof(*cxlds), GFP_KERNEL);
-	if (!cxlds) {
-		dev_err(dev, "No memory available\n");
+	if (!cxlds)
 		return ERR_PTR(-ENOMEM);
-	}
 
 	mutex_init(&cxlds->mbox_mutex);
 	mutex_init(&cxlds->event.log_lock);
Signature · 1 line
2.39.2
maintainer Reviewed-by on v2 1/2
#2 lore raw

Re: [PATCH v2 1/2] cxl/mbox: Remove redundant dev_err() after failed mem alloc

Quoted 6 lines · Raghu H

Issue found with checkpatch

A return of errno should be good enough if the memory allocation fails, the error message here is redundatant as per the coding style, removing it.

Quoted 20 lines
---
  drivers/cxl/core/mbox.c | 4 +---
  1 file changed, 1 insertion(+), 3 deletions(-)
drivers/cxl/core/mbox.c +1 -3
index f2addb457172..11ea145b4b1f 100644
@@ -1112,10 +1112,8 @@ struct cxl_dev_state *cxl_dev_state_create(struct device *dev)
  	struct cxl_dev_state *cxlds;
 
  	cxlds = devm_kzalloc(dev, sizeof(*cxlds), GFP_KERNEL);
-	if (!cxlds) {
-		dev_err(dev, "No memory available\n");
+	if (!cxlds)
  		return ERR_PTR(-ENOMEM);
-	}
 
  	mutex_init(&cxlds->mbox_mutex);
  	mutex_init(&cxlds->event.log_lock);
maintainer Reviewed-by on v2 1/2
#3 lore raw

Re: [PATCH v2 1/2] cxl/mbox: Remove redundant dev_err() after failed mem alloc

In reply to Raghu H
Quoted 11 lines · Raghu H

Issue found with checkpatch

A return of errno should be good enough if the memory allocation fails,
the error message here is redundatant as per the coding style, removing it.

---
 drivers/cxl/core/mbox.c | 4 +---

 1 file changed, 1 insertion(+), 3 deletions(-)

Looks good,

Quoted 18 lines
drivers/cxl/core/mbox.c +0 -0
index f2addb457172..11ea145b4b1f 100644
@@ -1112,10 +1112,8 @@ struct cxl_dev_state
 *cxl_dev_state_create(struct device *dev)
         struct cxl_dev_state *cxlds;


        cxlds = devm_kzalloc(dev, sizeof(*cxlds), GFP_KERNEL); -       if (!cxlds) {
-               dev_err(dev, "No memory available\n"); +       if (!cxlds)
                return ERR_PTR(-ENOMEM);
-       }

        mutex_init(&cxlds->mbox_mutex); mutex_init(&cxlds->event.log_lock);

#4 lore raw

Re: [PATCH v2 1/2] cxl/mbox: Remove redundant dev_err() after failed mem alloc

In reply to Raghu H
Quoted 4 lines · On venerdì 28 aprile 2023 03:22:34 CEST Raghu H wrote:

Issue found with checkpatch

A return of errno should be good enough if the memory allocation fails, the error message here is redundatant

Typo: it's "redundant". No problem, I think you shouldn't resend only for the purpose to fix this. But...

Quoted 3 lines

as per the coding style, removing it.

Is "Raghu H" the name you sign legal documents with?

If not, please send a new version signed-off-by your full legal name. Otherwise... sorry for the noise.

Thanks,

Fabio

Quoted 22 lines
---
 drivers/cxl/core/mbox.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/cxl/core/mbox.c +1 -4
index f2addb457172..11ea145b4b1f 100644
@@ -1112,10 +1112,8 @@ struct cxl_dev_state *cxl_dev_state_create(struct
 device *dev) struct cxl_dev_state *cxlds;
 
 	cxlds = devm_kzalloc(dev, sizeof(*cxlds), GFP_KERNEL);
-	if (!cxlds) {
-		dev_err(dev, "No memory available\n");
+	if (!cxlds)
 		return ERR_PTR(-ENOMEM);
-	}
 
 	mutex_init(&cxlds->mbox_mutex);
 	mutex_init(&cxlds->event.log_lock);
--

2.39.2

maintainer
#5 lore raw

Re: [PATCH v2 1/2] cxl/mbox: Remove redundant dev_err() after failed mem alloc

Quoted 9 lines · Fabio
Quoted 4 lines · On venerdì 28 aprile 2023 03:22:34 CEST Raghu H wrote:

Issue found with checkpatch

A return of errno should be good enough if the memory allocation fails, the error message here is redundatant

Typo: it's "redundant". No problem, I think you shouldn't resend only for the purpose to fix this. But...

Raghu,
checkpatch --codespell will catch misspellings in the commit log, when run on the HEAD^ commit or on the formatted patch file.

Quoted 6 lines
Quoted 3 lines

as per the coding style, removing it.

Is "Raghu H" the name you sign legal documents with?

Fabio,
Rather than asking a specific question to determine if this is a valid SOB, let's just point folks to the documentation to figure it out themselves. I'm aware that the 'sign legal documents' test has been used in the past, but kernel only actually requires a known identity.

https://www.kernel.org/doc/html/v4.17/process/submitting-patches.html#sign-your-work-the-developer-s-certificate-of-origin
https://github.com/cncf/foundation/blob/659fd32c86dc/dco-guidelines.md

Quoted 33 lines

If not, please send a new version signed-off-by your full legal name. Otherwise... sorry for the noise.

Thanks,

Fabio

Quoted 22 lines
---
 drivers/cxl/core/mbox.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/cxl/core/mbox.c +1 -4
index f2addb457172..11ea145b4b1f 100644
@@ -1112,10 +1112,8 @@ struct cxl_dev_state *cxl_dev_state_create(struct
 device *dev) struct cxl_dev_state *cxlds;
 
 	cxlds = devm_kzalloc(dev, sizeof(*cxlds), GFP_KERNEL);
-	if (!cxlds) {
-		dev_err(dev, "No memory available\n");
+	if (!cxlds)
 		return ERR_PTR(-ENOMEM);
-	}
 
 	mutex_init(&cxlds->mbox_mutex);
 	mutex_init(&cxlds->event.log_lock);
--

2.39.2

#6 lore raw

Re: [PATCH v2 1/2] cxl/mbox: Remove redundant dev_err() after failed mem alloc

Quoted 2 lines · On giovedì 4 maggio 2023 00:03:07 CEST Alison Schofield wrote:
Quoted 1 line · Fabio

On venerdì 28 aprile 2023 03:22:34 CEST Raghu H wrote:

[...]

Quoted 13 lines
Quoted 4 lines
Quoted 2 lines

Is "Raghu H" the name you sign legal documents with?

Fabio,
Rather than asking a specific question to determine if this is a valid SOB, let's just point folks to the documentation to figure it out themselves.
I'm aware that the 'sign legal documents' test
has been used in the past, but kernel only actually requires a known identity.

Quoted 3 lines

https://www.kernel.org/doc/html/v4.17/process/submitting-patches.html#sign-you
r-work-the-developer-s-certificate-of-origin
https://github.com/cncf/foundation/blob/659fd32c86dc/dco-guidelines.md

Alison,

Thanks for your suggestions.

I have just a couple of questions about this issue...

1) How do we know that the "real name", which the Linux official documentation refers to, should be interpreted in accordance to the document pointed by the second link you provided?

I mean, how can we be sure that the official documentation should be interpreted according to the second link, since it doesn't even cite that document from CNCF?

Can you provide links to documents / LKML's threads that state agreement of our Community about the "relaxed" interpretation by CNCF?

2) It looks that some maintainers (e.g., Greg K-H) still interpret "[] using your real name (sorry, no pseudonyms or anonymous contributions.)" in a "strict" and "common" sense.

Can you remember that Greg refused all patches from "Kloudifold" and why? If not, please take a look at the following two questions / objections from Greg:
https://lore.kernel.org/linux-staging/[email protected]/ and
https://lore.kernel.org/linux-staging/[email protected]/.

It seems that this issue it's not yet settled.
Am I overlooking something?

Again thanks,

Fabio

Quoted 6 lines
Quoted 6 lines

If not, please send a new version signed-off-by your full legal name. Otherwise... sorry for the noise.

Thanks,

Fabio

maintainer
#7 lore raw

Re: [PATCH v2 1/2] cxl/mbox: Remove redundant dev_err() after failed mem alloc

Quoted 33 lines · Fabio
Quoted 2 lines · On giovedì 4 maggio 2023 00:03:07 CEST Alison Schofield wrote:
Quoted 1 line · Fabio

On venerdì 28 aprile 2023 03:22:34 CEST Raghu H wrote:

[...]

Quoted 13 lines
Quoted 4 lines
Quoted 2 lines

Is "Raghu H" the name you sign legal documents with?

Fabio,
Rather than asking a specific question to determine if this is a valid SOB, let's just point folks to the documentation to figure it out themselves.
I'm aware that the 'sign legal documents' test
has been used in the past, but kernel only actually requires a known identity.

Quoted 3 lines

https://www.kernel.org/doc/html/v4.17/process/submitting-patches.html#sign-you
r-work-the-developer-s-certificate-of-origin
https://github.com/cncf/foundation/blob/659fd32c86dc/dco-guidelines.md

Alison,

Thanks for your suggestions.

I have just a couple of questions about this issue...

1) How do we know that the "real name", which the Linux official documentation refers to, should be interpreted in accordance to the document pointed by the second link you provided?

Quoted 6 lines

I mean, how can we be sure that the official documentation should be interpreted according to the second link, since it doesn't even cite that document from CNCF?

Can you provide links to documents / LKML's threads that state agreement of our Community about the "relaxed" interpretation by CNCF?

Citation is hidden it git history. See:
d4563201f33a ("Documentation: simplify and clarify DCO contribution example language")

Quoted 4 lines

2) It looks that some maintainers (e.g., Greg K-H) still interpret "[] using your real name (sorry, no pseudonyms or anonymous contributions.)" in a "strict" and "common" sense.

See the commit log above. The language was updated to say "using a known identity (sorry, no anonymous contributions.)"

Quoted 5 lines

Can you remember that Greg refused all patches from "Kloudifold" and why? If not, please take a look at the following two questions / objections from Greg:
https://lore.kernel.org/linux-staging/[email protected]/ and
https://lore.kernel.org/linux-staging/[email protected]/.

The second link above is Greg recognizing that known pseudonyms are allowed.

Quoted 3 lines

It seems that this issue it's not yet settled.
Am I overlooking something?

Hey, I'm not meaning to jump on you for asking Raghu the question. I realize you are being helpful to someone who is submitting their first patch. I'm just saying to make the submitter aware of the guideline and put the burden on them to make sure they're using a known identity.

Sometimes, what one person thinks of as 'common' is not. Let's refer to the docs and not add out personal or historical layers of interpretation on top of it. (The legal doc signing question may not apply to everyone.)

Alison

Quoted 14 lines

Again thanks,

Fabio

Quoted 6 lines
Quoted 6 lines

If not, please send a new version signed-off-by your full legal name. Otherwise... sorry for the noise.

Thanks,

Fabio

author
#8 lore raw

Re: [PATCH v2 1/2] cxl/mbox: Remove redundant dev_err() after failed mem alloc

Hello All,

Just checked the response to this patch, sorry for responding late here.

I will take a note on all the points raised and will follow the guidelines in future patches, and will correct this patch too.

Regards
Raghu

Quoted 91 lines · Alison Schofield
Quoted 33 lines · Fabio
Quoted 2 lines · On giovedì 4 maggio 2023 00:03:07 CEST Alison Schofield wrote:
Quoted 1 line · Fabio

On venerdì 28 aprile 2023 03:22:34 CEST Raghu H wrote:

[...]

Quoted 13 lines
Quoted 4 lines
Quoted 2 lines

Is "Raghu H" the name you sign legal documents with?

Fabio,
Rather than asking a specific question to determine if this is a valid SOB, let's just point folks to the documentation to figure it out themselves.
I'm aware that the 'sign legal documents' test
has been used in the past, but kernel only actually requires a known identity.

Quoted 3 lines

https://www.kernel.org/doc/html/v4.17/process/submitting-patches.html#sign-you
r-work-the-developer-s-certificate-of-origin
https://github.com/cncf/foundation/blob/659fd32c86dc/dco-guidelines.md

Alison,

Thanks for your suggestions.

I have just a couple of questions about this issue...

1) How do we know that the "real name", which the Linux official documentation refers to, should be interpreted in accordance to the document pointed by the second link you provided?

Quoted 6 lines

I mean, how can we be sure that the official documentation should be interpreted according to the second link, since it doesn't even cite that document from CNCF?

Can you provide links to documents / LKML's threads that state agreement of our Community about the "relaxed" interpretation by CNCF?

Citation is hidden it git history. See:
d4563201f33a ("Documentation: simplify and clarify DCO contribution example language")

Quoted 4 lines

2) It looks that some maintainers (e.g., Greg K-H) still interpret "[] using your real name (sorry, no pseudonyms or anonymous contributions.)" in a "strict" and "common" sense.

See the commit log above. The language was updated to say "using a known identity (sorry, no anonymous contributions.)"

Quoted 5 lines

Can you remember that Greg refused all patches from "Kloudifold" and why? If not, please take a look at the following two questions / objections from Greg:
https://lore.kernel.org/linux-staging/[email protected]/ and
https://lore.kernel.org/linux-staging/[email protected]/.

The second link above is Greg recognizing that known pseudonyms are allowed.

Quoted 3 lines

It seems that this issue it's not yet settled.
Am I overlooking something?

Hey, I'm not meaning to jump on you for asking Raghu the question. I realize you are being helpful to someone who is submitting their first patch. I'm just saying to make the submitter aware of the guideline and put the burden on them to make sure they're using a known identity.

Sometimes, what one person thinks of as 'common' is not. Let's refer to the docs and not add out personal or historical layers of interpretation on top of it. (The legal doc signing question may not apply to everyone.)

Alison

Quoted 14 lines

Again thanks,

Fabio

Quoted 6 lines
Quoted 6 lines

If not, please send a new version signed-off-by your full legal name. Otherwise... sorry for the noise.

Thanks,

Fabio

maintainer
#9 lore raw

Re: [PATCH v2 1/2] cxl/mbox: Remove redundant dev_err() after failed mem alloc

In reply to Raghu H
Quoted 1 line · Raghu H

Issue found with checkpatch

fyi for both patches, these are not "issues" - you can remove it, or the line altogether.

Thanks,
Davidlohr

maintainer
#10 lore raw

Re: [PATCH v2 1/2] cxl/mbox: Remove redundant dev_err() after failed mem alloc

Quoted 8 lines · Davidlohr Bueso
Quoted 1 line · Raghu H

Issue found with checkpatch

fyi for both patches, these are not "issues" - you can remove it, or the line altogether.

Thanks,
Davidlohr

Hi Raghu,

Perhaps this patchset got you more attention than you may have expected ;) So, this is an example of when reviewers disagree. I asked you to note that checkpatch found these 'issues' and David disagrees.

If David had known I'd asked you to update the commit log to include the checkpatch credit, he may have ignored it, or maybe not. I don't find the word 'issue' to be misused. There are many flavors of this phrase used in kernel commit logs that address checkpatch found issues.

The way the next round of reviewers knows what the first round asked for is by looking at the changelog. (And, if they need more detail, they pull up the previous patchset discussion.)

The changelog in the cover letter, or per patch, needs to explicitly say what has changed.

The v2 says this:

Quoted 3 lines
Quoted 3 lines

v2 changes:
Thanks Alison, Ira for your comments, modified the v1 patches as suggested. Dropped the patch containing tab changes in port.c

Next time, be more specific, like this:

v2 changes:
- Update commit logs to credit checkpatch (Alison)
- Update commit msgs to conform to subsystem style (Alison)
- Drop the patch containing tab changes in port.c (Ira)

Thanks,
Alison

author
#11 lore raw

PATCH v2 2/2 cxl/region: Remove else after return statement

In reply to Raghu H

Issue found with checkpatch

The else section here is redundant after return statement, removing it. Sanity and correctness is not affected due to this fix.

---
 drivers/cxl/core/region.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/cxl/core/region.c +4 -4
index f29028148806..a46d6ad9ef0a 100644
@@ -2666,11 +2666,11 @@ static int cxl_region_invalidate_memregion(struct cxl_region *cxlr)
 				"Bypassing cpu_cache_invalidate_memregion() for testing!\n");
 			clear_bit(CXL_REGION_F_INCOHERENT, &cxlr->flags);
 			return 0;
-		} else {
-			dev_err(&cxlr->dev,
-				"Failed to synchronize CPU cache state\n");
-			return -ENXIO;
 		}
+
+		dev_err(&cxlr->dev,
+			"Failed to synchronize CPU cache state\n");
+		return -ENXIO;
 	}
 
 	cpu_cache_invalidate_memregion(IORES_DESC_CXL);
Signature · 1 line
2.39.2
maintainer Reviewed-by on v2 2/2
#12 lore raw

Re: [PATCH v2 2/2] cxl/region: Remove else after return statement

Quoted 6 lines · Raghu H

Issue found with checkpatch

The else section here is redundant after return statement, removing it. Sanity and correctness is not affected due to this fix.

Quoted 24 lines
---
  drivers/cxl/core/region.c | 8 ++++----
  1 file changed, 4 insertions(+), 4 deletions(-)
drivers/cxl/core/region.c +4 -4
index f29028148806..a46d6ad9ef0a 100644
@@ -2666,11 +2666,11 @@ static int cxl_region_invalidate_memregion(struct cxl_region *cxlr)
  				"Bypassing cpu_cache_invalidate_memregion() for testing!\n");
  			clear_bit(CXL_REGION_F_INCOHERENT, &cxlr->flags);
  			return 0;
-		} else {
-			dev_err(&cxlr->dev,
-				"Failed to synchronize CPU cache state\n");
-			return -ENXIO;
  		}
+
+		dev_err(&cxlr->dev,
+			"Failed to synchronize CPU cache state\n");
+		return -ENXIO;
  	}
 
  	cpu_cache_invalidate_memregion(IORES_DESC_CXL);
maintainer Reviewed-by
#13 lore raw

Re: [PATCH v2 2/2] cxl/region: Remove else after return statement

Quoted 15 lines · Dave Jiang
Quoted 6 lines · Raghu H

Issue found with checkpatch

The else section here is redundant after return statement, removing it. Sanity and correctness is not affected due to this fix.

Quoted 3 lines

---
  drivers/cxl/core/region.c | 8 ++++----

  1 file changed, 4 insertions(+), 4 deletions(-)

Looks good,

Quoted 21 lines
Quoted 21 lines
drivers/cxl/core/region.c +4 -4
index f29028148806..a46d6ad9ef0a 100644
@@ -2666,11 +2666,11 @@ static int cxl_region_invalidate_memregion(struct cxl_region *cxlr)
                                 "Bypassing cpu_cache_invalidate_memregion() for testing!\n");
                         clear_bit(CXL_REGION_F_INCOHERENT, &cxlr->flags);
                         return 0;
-               } else {
-                       dev_err(&cxlr->dev,
-                               "Failed to synchronize CPU cache state\n");
-                       return -ENXIO;
                 }
+
+               dev_err(&cxlr->dev,
+                       "Failed to synchronize CPU cache state\n");
+               return -ENXIO;
         }

cpu_cache_invalidate_memregion(IORES_DESC_CXL);