2020-05-29 01:02:33

by Yi Wang

[permalink] [raw]
Subject: [PATCH] net: atm: Replace kmalloc with kzalloc in the error message

From: Liao Pingfang <[email protected]>

Use kzalloc instead of kmalloc in the error message according to
the previous kzalloc() call.

Signed-off-by: Liao Pingfang <[email protected]>
---
net/atm/lec.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/atm/lec.c b/net/atm/lec.c
index ca37f5a..33033d7 100644
--- a/net/atm/lec.c
+++ b/net/atm/lec.c
@@ -1537,7 +1537,7 @@ static struct lec_arp_table *make_entry(struct lec_priv *priv,

to_return = kzalloc(sizeof(struct lec_arp_table), GFP_ATOMIC);
if (!to_return) {
- pr_info("LEC: Arp entry kmalloc failed\n");
+ pr_info("LEC: Arp entry kzalloc failed\n");
return NULL;
}
ether_addr_copy(to_return->mac_addr, mac_addr);
--
2.9.5


2020-05-29 09:25:19

by Andy Shevchenko

[permalink] [raw]
Subject: Re: [PATCH] net: atm: Replace kmalloc with kzalloc in the error message

On Fri, May 29, 2020 at 09:01:42AM +0800, Yi Wang wrote:
> From: Liao Pingfang <[email protected]>
>
> Use kzalloc instead of kmalloc in the error message according to
> the previous kzalloc() call.

Looking into the context (atomic!) and error message itself I would rather drop
message completely.

> Signed-off-by: Liao Pingfang <[email protected]>
> ---
> net/atm/lec.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/atm/lec.c b/net/atm/lec.c
> index ca37f5a..33033d7 100644
> --- a/net/atm/lec.c
> +++ b/net/atm/lec.c
> @@ -1537,7 +1537,7 @@ static struct lec_arp_table *make_entry(struct lec_priv *priv,
>
> to_return = kzalloc(sizeof(struct lec_arp_table), GFP_ATOMIC);
> if (!to_return) {
> - pr_info("LEC: Arp entry kmalloc failed\n");
> + pr_info("LEC: Arp entry kzalloc failed\n");
> return NULL;
> }
> ether_addr_copy(to_return->mac_addr, mac_addr);
> --
> 2.9.5
>

--
With Best Regards,
Andy Shevchenko


2020-05-29 17:57:37

by Markus Elfring

[permalink] [raw]
Subject: Re: [PATCH] net: atm: Replace kmalloc with kzalloc in the error message

> Looking into the context (atomic!) and error message itself I would rather drop
> message completely.

How do you think about to take another look at a previous update suggestion
like the following?

net/atm: Delete an error message for a failed memory allocation in five functions
https://patchwork.ozlabs.org/project/netdev/patch/[email protected]/
https://lore.kernel.org/lkml/[email protected]/
https://lore.kernel.org/patchwork/patch/838867/
https://lkml.org/lkml/2017/10/9/1009

Regards,
Markus