linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net/core: tidy up an error message
@ 2018-12-01  4:51 Qian Cai
  2018-12-01 14:43 ` Joe Perches
  2018-12-01 17:17 ` Stephen Hemminger
  0 siblings, 2 replies; 3+ messages in thread
From: Qian Cai @ 2018-12-01  4:51 UTC (permalink / raw)
  To: davem; +Cc: yisen.zhuang, salil.mehta, netdev, linux-kernel, Qian Cai

netif_napi_add() could report an error like this below due to it allows
to pass a format string for wildcarding before calling
dev_get_valid_name(),

"netif_napi_add() called with weight 256 on device eth%d"

For example, hns_enet_drv module does this.

hns_nic_try_get_ae
  hns_nic_init_ring_data
    netif_napi_add
  register_netdev
    dev_get_valid_name

Hence, make it a bit more human-readable.

Signed-off-by: Qian Cai <cai@gmx.us>
---
 net/core/dev.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/core/dev.c b/net/core/dev.c
index ddc551f24ba2..bbd7cdbbbebd 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -6205,7 +6205,8 @@ void netif_napi_add(struct net_device *dev, struct napi_struct *napi,
 	napi->poll = poll;
 	if (weight > NAPI_POLL_WEIGHT)
 		pr_err_once("netif_napi_add() called with weight %d on device %s\n",
-			    weight, dev->name);
+			    weight,
+			    !strchr(dev->name, '%') ? dev->name : "unknown");
 	napi->weight = weight;
 	list_add(&napi->dev_list, &dev->napi_list);
 	napi->dev = dev;
-- 
2.17.2 (Apple Git-113)


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

* Re: [PATCH] net/core: tidy up an error message
  2018-12-01  4:51 [PATCH] net/core: tidy up an error message Qian Cai
@ 2018-12-01 14:43 ` Joe Perches
  2018-12-01 17:17 ` Stephen Hemminger
  1 sibling, 0 replies; 3+ messages in thread
From: Joe Perches @ 2018-12-01 14:43 UTC (permalink / raw)
  To: Qian Cai, davem; +Cc: yisen.zhuang, salil.mehta, netdev, linux-kernel

On Fri, 2018-11-30 at 23:51 -0500, Qian Cai wrote:
> netif_napi_add() could report an error like this below due to it allows
> to pass a format string for wildcarding before calling
> dev_get_valid_name(),
> 
> "netif_napi_add() called with weight 256 on device eth%d"
> 
> For example, hns_enet_drv module does this.
> 
> hns_nic_try_get_ae
>   hns_nic_init_ring_data
>     netif_napi_add
>   register_netdev
>     dev_get_valid_name
> 
> Hence, make it a bit more human-readable.
[]
> diff --git a/net/core/dev.c b/net/core/dev.c
[]
> @@ -6205,7 +6205,8 @@ void netif_napi_add(struct net_device *dev, struct napi_struct *napi,
>  	napi->poll = poll;
>  	if (weight > NAPI_POLL_WEIGHT)
>  		pr_err_once("netif_napi_add() called with weight %d on device %s\n",
> -			    weight, dev->name);
> +			    weight,
> +			    !strchr(dev->name, '%') ? dev->name : "unknown");

perhaps instead use netdev_err_once



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

* Re: [PATCH] net/core: tidy up an error message
  2018-12-01  4:51 [PATCH] net/core: tidy up an error message Qian Cai
  2018-12-01 14:43 ` Joe Perches
@ 2018-12-01 17:17 ` Stephen Hemminger
  1 sibling, 0 replies; 3+ messages in thread
From: Stephen Hemminger @ 2018-12-01 17:17 UTC (permalink / raw)
  To: Qian Cai; +Cc: davem, yisen.zhuang, salil.mehta, netdev, linux-kernel

On Fri, 30 Nov 2018 23:51:53 -0500
Qian Cai <cai@gmx.us> wrote:

> +			    weight,
> +			    !strchr(dev->name, '%') ? dev->name : "unknown"

Agree with Joe, use netdev_err_once or use netdev_name().

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

end of thread, other threads:[~2018-12-01 17:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-01  4:51 [PATCH] net/core: tidy up an error message Qian Cai
2018-12-01 14:43 ` Joe Perches
2018-12-01 17:17 ` Stephen Hemminger

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).