* [PATCH v7 0/2] Fixing check patch styling issues
@ 2023-07-26 7:34 Raghu Halharvi
2023-07-26 7:34 ` [PATCH v7 1/2] cxl/mbox: Remove redundant dev_err() after failed mem alloc Raghu Halharvi
2023-07-26 7:34 ` [PATCH v7 2/2] cxl/region: Remove else after return statement Raghu Halharvi
0 siblings, 2 replies; 6+ messages in thread
From: Raghu Halharvi @ 2023-07-26 7:34 UTC (permalink / raw)
To: linux-cxl, Alison Schofield, raghuhack78, ira.weiny, bwidawsk,
dan.j.williams, vishal.l.verma
Cc: linux-kernel
v7 changes:
- Append the actual patches that were omitted in previos end
- Update the v6 changelog
- Reorder and remove the blank line in patch tags
(Alison)
v6 changes:
- Rebase
- Do the redundant dev_err() cleanup in cxl_memdev_state_create()
(Alison/Ira)
v5 changes:
- Updated the missing reviewed tag in "cxl/mbox: Remove redundant
dev_err() after failed mem alloc" patch (Dave Jiang)
v4 changes:
- Updated the respective patches with reviewers tags for respective
patches(Dave Jiang)
v3 changes:
- Update the cover letter and commit message with full author
name(Fabio/Alison)
- Correct the "typo error" in commit message(Fabio)
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 Halharvi (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(-)
base-commit: 0b5547c51827e053cc754db47d3ec3e6c2c451d2
--
2.39.2
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v7 1/2] cxl/mbox: Remove redundant dev_err() after failed mem alloc
2023-07-26 7:34 [PATCH v7 0/2] Fixing check patch styling issues Raghu Halharvi
@ 2023-07-26 7:34 ` Raghu Halharvi
2023-07-30 2:17 ` Alison Schofield
2023-07-26 7:34 ` [PATCH v7 2/2] cxl/region: Remove else after return statement Raghu Halharvi
1 sibling, 1 reply; 6+ messages in thread
From: Raghu Halharvi @ 2023-07-26 7:34 UTC (permalink / raw)
To: linux-cxl, Alison Schofield, raghuhack78, ira.weiny, bwidawsk,
dan.j.williams, vishal.l.verma
Cc: linux-kernel, Dave Jiang
Issue found with checkpatch
A return of errno should be good enough if the memory allocation fails,
the error message here is redundant as per the coding style, removing
it.
Signed-off-by: Raghu Halharvi <raghuhack78@gmail.com>
Reviewed-by: Vishal Verma <vishal.l.verma@intel.com>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Reviewed-by: Ira Weiny <ira.weiny@intel.com>
---
drivers/cxl/core/mbox.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/cxl/core/mbox.c b/drivers/cxl/core/mbox.c
index d6d067fbee97..af7f37cea871 100644
--- a/drivers/cxl/core/mbox.c
+++ b/drivers/cxl/core/mbox.c
@@ -1325,10 +1325,8 @@ struct cxl_memdev_state *cxl_memdev_state_create(struct device *dev)
struct cxl_memdev_state *mds;
mds = devm_kzalloc(dev, sizeof(*mds), GFP_KERNEL);
- if (!mds) {
- dev_err(dev, "No memory available\n");
+ if (!mds)
return ERR_PTR(-ENOMEM);
- }
mutex_init(&mds->mbox_mutex);
mutex_init(&mds->event.log_lock);
--
2.39.2
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH v7 1/2] cxl/mbox: Remove redundant dev_err() after failed mem alloc
2023-07-26 7:34 ` [PATCH v7 1/2] cxl/mbox: Remove redundant dev_err() after failed mem alloc Raghu Halharvi
@ 2023-07-30 2:17 ` Alison Schofield
0 siblings, 0 replies; 6+ messages in thread
From: Alison Schofield @ 2023-07-30 2:17 UTC (permalink / raw)
To: Raghu Halharvi
Cc: linux-cxl, ira.weiny, bwidawsk, dan.j.williams, vishal.l.verma,
linux-kernel, Dave Jiang
On Wed, Jul 26, 2023 at 07:34:20AM +0000, Raghu Halharvi wrote:
> Issue found with checkpatch
>
> A return of errno should be good enough if the memory allocation fails,
> the error message here is redundant as per the coding style, removing
> it.
>
> Signed-off-by: Raghu Halharvi <raghuhack78@gmail.com>
> Reviewed-by: Vishal Verma <vishal.l.verma@intel.com>
> Reviewed-by: Dave Jiang <dave.jiang@intel.com>
> Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Thanks for follow-up Raghu!
Reviewed-by: Alison Schofield <alison.schofield@intel.com>
> ---
> drivers/cxl/core/mbox.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/cxl/core/mbox.c b/drivers/cxl/core/mbox.c
> index d6d067fbee97..af7f37cea871 100644
> --- a/drivers/cxl/core/mbox.c
> +++ b/drivers/cxl/core/mbox.c
> @@ -1325,10 +1325,8 @@ struct cxl_memdev_state *cxl_memdev_state_create(struct device *dev)
> struct cxl_memdev_state *mds;
>
> mds = devm_kzalloc(dev, sizeof(*mds), GFP_KERNEL);
> - if (!mds) {
> - dev_err(dev, "No memory available\n");
> + if (!mds)
> return ERR_PTR(-ENOMEM);
> - }
>
> mutex_init(&mds->mbox_mutex);
> mutex_init(&mds->event.log_lock);
> --
> 2.39.2
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v7 2/2] cxl/region: Remove else after return statement
2023-07-26 7:34 [PATCH v7 0/2] Fixing check patch styling issues Raghu Halharvi
2023-07-26 7:34 ` [PATCH v7 1/2] cxl/mbox: Remove redundant dev_err() after failed mem alloc Raghu Halharvi
@ 2023-07-26 7:34 ` Raghu Halharvi
2023-07-30 2:18 ` Alison Schofield
1 sibling, 1 reply; 6+ messages in thread
From: Raghu Halharvi @ 2023-07-26 7:34 UTC (permalink / raw)
To: linux-cxl, Alison Schofield, raghuhack78, ira.weiny, bwidawsk,
dan.j.williams, vishal.l.verma
Cc: linux-kernel, Dave Jiang
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.
Signed-off-by: Raghu Halharvi <raghuhack78@gmail.com>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Reviewed-by: Vishal Verma <vishal.l.verma@intel.com>
Reviewed-by: Ira Weiny <ira.weiny@intel.com>
---
drivers/cxl/core/region.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c
index e115ba382e04..bfd3b13dd2c1 100644
--- a/drivers/cxl/core/region.c
+++ b/drivers/cxl/core/region.c
@@ -133,11 +133,11 @@ static int cxl_region_invalidate_memregion(struct cxl_region *cxlr)
&cxlr->dev,
"Bypassing cpu_cache_invalidate_memregion() for testing!\n");
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);
--
2.39.2
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH v7 2/2] cxl/region: Remove else after return statement
2023-07-26 7:34 ` [PATCH v7 2/2] cxl/region: Remove else after return statement Raghu Halharvi
@ 2023-07-30 2:18 ` Alison Schofield
2023-07-30 20:09 ` Joe Perches
0 siblings, 1 reply; 6+ messages in thread
From: Alison Schofield @ 2023-07-30 2:18 UTC (permalink / raw)
To: Raghu Halharvi
Cc: linux-cxl, ira.weiny, bwidawsk, dan.j.williams, vishal.l.verma,
linux-kernel, Dave Jiang
On Wed, Jul 26, 2023 at 07:34:21AM +0000, Raghu Halharvi wrote:
> 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.
>
> Signed-off-by: Raghu Halharvi <raghuhack78@gmail.com>
> Reviewed-by: Dave Jiang <dave.jiang@intel.com>
> Reviewed-by: Vishal Verma <vishal.l.verma@intel.com>
> Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Reviewed-by: Alison Schofield <alison.schofield@intel.com>
> ---
> drivers/cxl/core/region.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c
> index e115ba382e04..bfd3b13dd2c1 100644
> --- a/drivers/cxl/core/region.c
> +++ b/drivers/cxl/core/region.c
> @@ -133,11 +133,11 @@ static int cxl_region_invalidate_memregion(struct cxl_region *cxlr)
> &cxlr->dev,
> "Bypassing cpu_cache_invalidate_memregion() for testing!\n");
> 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);
> --
> 2.39.2
>
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH v7 2/2] cxl/region: Remove else after return statement
2023-07-30 2:18 ` Alison Schofield
@ 2023-07-30 20:09 ` Joe Perches
0 siblings, 0 replies; 6+ messages in thread
From: Joe Perches @ 2023-07-30 20:09 UTC (permalink / raw)
To: Alison Schofield, Raghu Halharvi
Cc: linux-cxl, ira.weiny, bwidawsk, dan.j.williams, vishal.l.verma,
linux-kernel, Dave Jiang
On Sat, 2023-07-29 at 19:18 -0700, Alison Schofield wrote:
> On Wed, Jul 26, 2023 at 07:34:21AM +0000, Raghu Halharvi wrote:
> > 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.
> >
> > Signed-off-by: Raghu Halharvi <raghuhack78@gmail.com>
> > Reviewed-by: Dave Jiang <dave.jiang@intel.com>
> > Reviewed-by: Vishal Verma <vishal.l.verma@intel.com>
> > Reviewed-by: Ira Weiny <ira.weiny@intel.com>
>
> Reviewed-by: Alison Schofield <alison.schofield@intel.com>
>
>
>
> > ---
> > drivers/cxl/core/region.c | 8 ++++----
> > 1 file changed, 4 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c
> > index e115ba382e04..bfd3b13dd2c1 100644
> > --- a/drivers/cxl/core/region.c
> > +++ b/drivers/cxl/core/region.c
> > @@ -133,11 +133,11 @@ static int cxl_region_invalidate_memregion(struct cxl_region *cxlr)
> > &cxlr->dev,
> > "Bypassing cpu_cache_invalidate_memregion() for testing!\n");
> > 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);
> > --
> > 2.39.2
> >
My preference would be for this function to be something like:
---
static int cxl_region_invalidate_memregion(struct cxl_region *cxlr)
{
if (cpu_cache_has_invalidate_memregion()) {
cpu_cache_invalidate_memregion(IORES_DESC_CXL);
return 0;
}
if (IS_ENABLED(CONFIG_CXL_REGION_INVALIDATION_TEST)) {
dev_warn_once(&cxlr->dev,
"Bypassing cpu_cache_invalidate_memregion() for testing!\n");
return 0;
}
dev_err(&cxlr->dev, "Failed to synchronize CPU cache state\n");
return -ENXIO;
}
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2023-07-30 20:17 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-26 7:34 [PATCH v7 0/2] Fixing check patch styling issues Raghu Halharvi
2023-07-26 7:34 ` [PATCH v7 1/2] cxl/mbox: Remove redundant dev_err() after failed mem alloc Raghu Halharvi
2023-07-30 2:17 ` Alison Schofield
2023-07-26 7:34 ` [PATCH v7 2/2] cxl/region: Remove else after return statement Raghu Halharvi
2023-07-30 2:18 ` Alison Schofield
2023-07-30 20:09 ` Joe Perches
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox