netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] hyperv/netvsc: Delete two error messages for a failed memory allocation in netvsc_init_buf()
@ 2018-01-07 20:10 SF Markus Elfring
  2018-01-08 15:37 ` Haiyang Zhang
  0 siblings, 1 reply; 4+ messages in thread
From: SF Markus Elfring @ 2018-01-07 20:10 UTC (permalink / raw)
  To: devel, netdev, Haiyang Zhang, K. Y. Srinivasan, Stephen Hemminger
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 7 Jan 2018 21:03:26 +0100

Omit extra messages for a memory allocation failure in this function.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/net/hyperv/netvsc.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c
index 17e529af79dc..c1ec02f801f6 100644
--- a/drivers/net/hyperv/netvsc.c
+++ b/drivers/net/hyperv/netvsc.c
@@ -275,9 +275,6 @@ static int netvsc_init_buf(struct hv_device *device,
 
 	net_device->recv_buf = vzalloc(buf_size);
 	if (!net_device->recv_buf) {
-		netdev_err(ndev,
-			   "unable to allocate receive buffer of size %u\n",
-			   buf_size);
 		ret = -ENOMEM;
 		goto cleanup;
 	}
@@ -357,8 +354,6 @@ static int netvsc_init_buf(struct hv_device *device,
 
 	net_device->send_buf = vzalloc(buf_size);
 	if (!net_device->send_buf) {
-		netdev_err(ndev, "unable to allocate send buffer of size %u\n",
-			   buf_size);
 		ret = -ENOMEM;
 		goto cleanup;
 	}
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* RE: [PATCH] hyperv/netvsc: Delete two error messages for a failed memory allocation in netvsc_init_buf()
  2018-01-07 20:10 [PATCH] hyperv/netvsc: Delete two error messages for a failed memory allocation in netvsc_init_buf() SF Markus Elfring
@ 2018-01-08 15:37 ` Haiyang Zhang
  2018-01-08 18:19   ` SF Markus Elfring
  2018-01-15  9:00   ` SF Markus Elfring
  0 siblings, 2 replies; 4+ messages in thread
From: Haiyang Zhang @ 2018-01-08 15:37 UTC (permalink / raw)
  To: SF Markus Elfring, devel@linuxdriverproject.org,
	netdev@vger.kernel.org, KY Srinivasan, Stephen Hemminger
  Cc: LKML, kernel-janitors@vger.kernel.org



> -----Original Message-----
> From: SF Markus Elfring [mailto:elfring@users.sourceforge.net]
> Sent: Sunday, January 7, 2018 3:10 PM
> To: devel@linuxdriverproject.org; netdev@vger.kernel.org; Haiyang Zhang
> <haiyangz@microsoft.com>; KY Srinivasan <kys@microsoft.com>; Stephen
> Hemminger <sthemmin@microsoft.com>
> Cc: LKML <linux-kernel@vger.kernel.org>; kernel-janitors@vger.kernel.org
> Subject: [PATCH] hyperv/netvsc: Delete two error messages for a failed
> memory allocation in netvsc_init_buf()
> 
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sun, 7 Jan 2018 21:03:26 +0100
> 
> Omit extra messages for a memory allocation failure in this function.
> 
> This issue was detected by using the Coccinelle software.
> 
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
>  drivers/net/hyperv/netvsc.c | 5 -----
>  1 file changed, 5 deletions(-)
> 
> diff --git a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c index
> 17e529af79dc..c1ec02f801f6 100644
> --- a/drivers/net/hyperv/netvsc.c
> +++ b/drivers/net/hyperv/netvsc.c
> @@ -275,9 +275,6 @@ static int netvsc_init_buf(struct hv_device *device,
> 
>  	net_device->recv_buf = vzalloc(buf_size);
>  	if (!net_device->recv_buf) {
> -		netdev_err(ndev,
> -			   "unable to allocate receive buffer of size %u\n",
> -			   buf_size);
>  		ret = -ENOMEM;
>  		goto cleanup;
>  	}
> @@ -357,8 +354,6 @@ static int netvsc_init_buf(struct hv_device *device,
> 
>  	net_device->send_buf = vzalloc(buf_size);
>  	if (!net_device->send_buf) {
> -		netdev_err(ndev, "unable to allocate send buffer of
> size %u\n",
> -			   buf_size);
>  		ret = -ENOMEM;
>  		goto cleanup;
>  	}

These messages are not displayed anywhere else:
"unable to allocate receive buffer of size %u\n"
"unable to allocate send buffer of size %u\n",

After set ret = -ENOMEM; and cleanup, we won't know which buffer allocation failed without the error message.

So please do not remove these messages.

Thanks,
- Haiyang

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: hyperv/netvsc: Delete two error messages for a failed memory allocation in netvsc_init_buf()
  2018-01-08 15:37 ` Haiyang Zhang
@ 2018-01-08 18:19   ` SF Markus Elfring
  2018-01-15  9:00   ` SF Markus Elfring
  1 sibling, 0 replies; 4+ messages in thread
From: SF Markus Elfring @ 2018-01-08 18:19 UTC (permalink / raw)
  To: Haiyang Zhang, devel@linuxdriverproject.org, netdev
  Cc: KY Srinivasan, Stephen Hemminger, LKML, kernel-janitors

> These messages are not displayed anywhere else:
> "unable to allocate receive buffer of size %u\n"
> "unable to allocate send buffer of size %u\n",
> 
> After set ret = -ENOMEM; and cleanup, we won't know which buffer allocation failed without the error message.

Do you notice a Linux allocation failure report before them in your system?


> So please do not remove these messages.

How much does the distinction matter for these buffers?

Regards,
Markus

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: hyperv/netvsc: Delete two error messages for a failed memory allocation in netvsc_init_buf()
  2018-01-08 15:37 ` Haiyang Zhang
  2018-01-08 18:19   ` SF Markus Elfring
@ 2018-01-15  9:00   ` SF Markus Elfring
  1 sibling, 0 replies; 4+ messages in thread
From: SF Markus Elfring @ 2018-01-15  9:00 UTC (permalink / raw)
  To: Haiyang Zhang, devel, netdev
  Cc: KY Srinivasan, Stephen Hemminger, LKML, kernel-janitors

> These messages are not displayed anywhere else:
> "unable to allocate receive buffer of size %u\n"
> "unable to allocate send buffer of size %u\n",
> 
> After set ret = -ENOMEM; and cleanup, we won't know which buffer allocation failed without the error message.

How do you think about to achieve the distinction for these buffers by any other means?

Can a detailed function call stack dump be appropriate?


> So please do not remove these messages.

Would you dare to adjust this function implementation in any other ways?

Regards,
Markus

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-01-15  9:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-07 20:10 [PATCH] hyperv/netvsc: Delete two error messages for a failed memory allocation in netvsc_init_buf() SF Markus Elfring
2018-01-08 15:37 ` Haiyang Zhang
2018-01-08 18:19   ` SF Markus Elfring
2018-01-15  9:00   ` SF Markus Elfring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).