linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] net/core: tidy up an error message
@ 2018-12-02  2:11 Qian Cai
  2018-12-04  0:15 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Qian Cai @ 2018-12-02  2:11 UTC (permalink / raw)
  To: davem
  Cc: yisen.zhuang, salil.mehta, joe, stephen, 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 by using netdev_err_once()
instead.

Signed-off-by: Qian Cai <cai@gmx.us>
---

v2:
* Used netdev_err_once() suggested by Joe.
* Replaced the hard-coded function name with __func__.

 net/core/dev.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/core/dev.c b/net/core/dev.c
index ddc551f24ba2..65ac80970d1f 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -6204,8 +6204,8 @@ void netif_napi_add(struct net_device *dev, struct napi_struct *napi,
 	napi->skb = NULL;
 	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);
+		netdev_err_once(dev, "%s() called with weight %d\n", __func__,
+				weight);
 	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] 2+ messages in thread

end of thread, other threads:[~2018-12-04  0:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-02  2:11 [PATCH v2] net/core: tidy up an error message Qian Cai
2018-12-04  0:15 ` David Miller

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