From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
To: aviad.krawczyk@huawei.com, davem@davemloft.net
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: Re: [PATCH net-next] hinic: Use devm_kasprintf instead of hard coding it
Date: Fri, 14 Jun 2019 12:11:22 +0000 [thread overview]
Message-ID: <c55cd76d-2d3e-d9b2-1f1b-4881102c407d@wanadoo.fr> (raw)
In-Reply-To: <20190613195412.1702-1-christophe.jaillet@wanadoo.fr>
Hi,
I got a:
<aviad.krawczyk@huawei.com>: host huawei.com[103.218.216.136] said: 550
5.1.1 Error: invalid recipients is found from 80.12.242.127
However, MAINTAINERS has:
HUAWEI ETHERNET DRIVER
M: Aviad Krawczyk <aviad.krawczyk@huawei.com>
L: netdev@vger.kernel.org
S: Supported
F: Documentation/networking/hinic.txt
F: drivers/net/ethernet/huawei/hinic/
I don't know how this should be fixed (neither if it should be...), so if s.o. knows, please do.
Best regards,
Christophe Jaillet
Le 13/06/2019 à 21:54, Christophe JAILLET a écrit :
> 'devm_kasprintf' is less verbose than:
> snprintf(NULL, 0, ...);
> devm_kzalloc(...);
> sprintf
> so use it instead.
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> drivers/net/ethernet/huawei/hinic/hinic_rx.c | 8 +++-----
> 1 file changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/net/ethernet/huawei/hinic/hinic_rx.c b/drivers/net/ethernet/huawei/hinic/hinic_rx.c
> index 9b4082557ad5..95b09fd110d3 100644
> --- a/drivers/net/ethernet/huawei/hinic/hinic_rx.c
> +++ b/drivers/net/ethernet/huawei/hinic/hinic_rx.c
> @@ -493,7 +493,7 @@ int hinic_init_rxq(struct hinic_rxq *rxq, struct hinic_rq *rq,
> struct net_device *netdev)
> {
> struct hinic_qp *qp = container_of(rq, struct hinic_qp, rq);
> - int err, pkts, irqname_len;
> + int err, pkts;
>
> rxq->netdev = netdev;
> rxq->rq = rq;
> @@ -502,13 +502,11 @@ int hinic_init_rxq(struct hinic_rxq *rxq, struct hinic_rq *rq,
>
> rxq_stats_init(rxq);
>
> - irqname_len = snprintf(NULL, 0, "hinic_rxq%d", qp->q_id) + 1;
> - rxq->irq_name = devm_kzalloc(&netdev->dev, irqname_len, GFP_KERNEL);
> + rxq->irq_name = devm_kasprintf(&netdev->dev, GFP_KERNEL,
> + "hinic_rxq%d", qp->q_id);
> if (!rxq->irq_name)
> return -ENOMEM;
>
> - sprintf(rxq->irq_name, "hinic_rxq%d", qp->q_id);
> -
> pkts = rx_alloc_pkts(rxq);
> if (!pkts) {
> err = -ENOMEM;
next prev parent reply other threads:[~2019-06-14 12:11 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-13 19:54 [PATCH net-next] hinic: Use devm_kasprintf instead of hard coding it Christophe JAILLET
2019-06-14 12:11 ` Christophe JAILLET [this message]
2019-06-14 12:21 ` Julia Lawall
2019-06-15 20:38 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c55cd76d-2d3e-d9b2-1f1b-4881102c407d@wanadoo.fr \
--to=christophe.jaillet@wanadoo.fr \
--cc=aviad.krawczyk@huawei.com \
--cc=davem@davemloft.net \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).