A return of errno should be good enough if the memory allocation fails,
the debug message here is redundatant as per the coding style, removing it.
Signed-off-by: Raghu H <[email protected]>
---
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 f2addb457172..11ea145b4b1f 100644
--- a/drivers/cxl/core/mbox.c
+++ b/drivers/cxl/core/mbox.c
@@ -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
Raghu H wrote:
> A return of errno should be good enough if the memory allocation fails,
> the debug message here is redundatant as per the coding style, removing it.
>
> Signed-off-by: Raghu H <[email protected]>
I'm not seeing a lot of value in this error message either. There are
plenty of other places probe can fail without any errors at all.
I guess:
Reviewed-by: Ira Weiny <[email protected]>
On Wed, Apr 19, 2023 at 11:14:41AM +0000, Raghu H wrote:
> A return of errno should be good enough if the memory allocation fails,
> the debug message here is redundatant as per the coding style, removing it.
Hi Raghu,
Thanks for the patch. The code change looks fine.
Here is some feedback on the commit msg and log:
This removes a dev_err() not a debug message, dev_dbg()
Commit msg can be clearer like:
cxl/mbox: Remove redundant dev_err() after failed mem alloc
Please include PATCH in the subject line.
See Documentation/process/submitting-patches.rst or peruse other
patches on the mailing list and subsystem to see examples.
Alison
>
> Signed-off-by: Raghu H <[email protected]>
> ---
> 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 f2addb457172..11ea145b4b1f 100644
> --- a/drivers/cxl/core/mbox.c
> +++ b/drivers/cxl/core/mbox.c
> @@ -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
>