From mboxrd@z Thu Jan 1 00:00:00 1970 From: Joe Perches Subject: Re: [PATCH] net/core: tidy up an error message Date: Sat, 01 Dec 2018 06:43:40 -0800 Message-ID: References: <20181201045153.4035-1-cai@gmx.us> Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit Cc: yisen.zhuang@huawei.com, salil.mehta@huawei.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org To: Qian Cai , davem@davemloft.net Return-path: In-Reply-To: <20181201045153.4035-1-cai@gmx.us> Sender: linux-kernel-owner@vger.kernel.org List-Id: netdev.vger.kernel.org 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