* [PATCH net-next] net: hinic: Use devm_kasprintf()
@ 2023-09-11 19:50 Christophe JAILLET
2023-09-12 15:24 ` Simon Horman
2023-09-13 11:30 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Christophe JAILLET @ 2023-09-11 19:50 UTC (permalink / raw)
To: Cai Huoqing, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni
Cc: linux-kernel, kernel-janitors, Christophe JAILLET, netdev
Use devm_kasprintf() instead of hand writing it.
This is less verbose and less error prone.
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
drivers/net/ethernet/huawei/hinic/hinic_tx.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ethernet/huawei/hinic/hinic_tx.c b/drivers/net/ethernet/huawei/hinic/hinic_tx.c
index ad47ac51a139..9b60966736db 100644
--- a/drivers/net/ethernet/huawei/hinic/hinic_tx.c
+++ b/drivers/net/ethernet/huawei/hinic/hinic_tx.c
@@ -861,7 +861,7 @@ int hinic_init_txq(struct hinic_txq *txq, struct hinic_sq *sq,
struct hinic_qp *qp = container_of(sq, struct hinic_qp, sq);
struct hinic_dev *nic_dev = netdev_priv(netdev);
struct hinic_hwdev *hwdev = nic_dev->hwdev;
- int err, irqname_len;
+ int err;
txq->netdev = netdev;
txq->sq = sq;
@@ -882,15 +882,13 @@ int hinic_init_txq(struct hinic_txq *txq, struct hinic_sq *sq,
goto err_alloc_free_sges;
}
- irqname_len = snprintf(NULL, 0, "%s_txq%d", netdev->name, qp->q_id) + 1;
- txq->irq_name = devm_kzalloc(&netdev->dev, irqname_len, GFP_KERNEL);
+ txq->irq_name = devm_kasprintf(&netdev->dev, GFP_KERNEL, "%s_txq%d",
+ netdev->name, qp->q_id);
if (!txq->irq_name) {
err = -ENOMEM;
goto err_alloc_irqname;
}
- sprintf(txq->irq_name, "%s_txq%d", netdev->name, qp->q_id);
-
err = hinic_hwdev_hw_ci_addr_set(hwdev, sq, CI_UPDATE_NO_PENDING,
CI_UPDATE_NO_COALESC);
if (err)
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] net: hinic: Use devm_kasprintf()
2023-09-11 19:50 [PATCH net-next] net: hinic: Use devm_kasprintf() Christophe JAILLET
@ 2023-09-12 15:24 ` Simon Horman
2023-09-13 11:30 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Simon Horman @ 2023-09-12 15:24 UTC (permalink / raw)
To: Christophe JAILLET
Cc: Cai Huoqing, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, linux-kernel, kernel-janitors, netdev
On Mon, Sep 11, 2023 at 09:50:52PM +0200, Christophe JAILLET wrote:
> Use devm_kasprintf() instead of hand writing it.
> This is less verbose and less error prone.
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: Simon Horman <horms@kernel.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] net: hinic: Use devm_kasprintf()
2023-09-11 19:50 [PATCH net-next] net: hinic: Use devm_kasprintf() Christophe JAILLET
2023-09-12 15:24 ` Simon Horman
@ 2023-09-13 11:30 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-09-13 11:30 UTC (permalink / raw)
To: Christophe JAILLET
Cc: cai.huoqing, davem, edumazet, kuba, pabeni, linux-kernel,
kernel-janitors, netdev
Hello:
This patch was applied to netdev/net-next.git (main)
by David S. Miller <davem@davemloft.net>:
On Mon, 11 Sep 2023 21:50:52 +0200 you wrote:
> Use devm_kasprintf() instead of hand writing it.
> This is less verbose and less error prone.
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> drivers/net/ethernet/huawei/hinic/hinic_tx.c | 8 +++-----
> 1 file changed, 3 insertions(+), 5 deletions(-)
Here is the summary with links:
- [net-next] net: hinic: Use devm_kasprintf()
https://git.kernel.org/netdev/net-next/c/9cc91173cf1b
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-09-13 11:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-11 19:50 [PATCH net-next] net: hinic: Use devm_kasprintf() Christophe JAILLET
2023-09-12 15:24 ` Simon Horman
2023-09-13 11:30 ` patchwork-bot+netdevbpf
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).