Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp128986ybi; Thu, 13 Jun 2019 12:54:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqxsktcitRq+yyYn7FUDaeQFoum5khI+9UJjCVUKnyQ99eGgVhN70pNDOw/6uVcn2M7CA1tP X-Received: by 2002:a62:1bd1:: with SMTP id b200mr69957151pfb.210.1560455686570; Thu, 13 Jun 2019 12:54:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560455686; cv=none; d=google.com; s=arc-20160816; b=nSvy3rnOG1xUZ2yo47BJJoDvGMdWmSHcGh825ntbXbF7Tvr/DQPuduEAGgS6Fs3/i/ mnBtFRBNjiUo56df5WYKj4WBioyKizltriL+8KQfv14zoP+lsh/NNaRHqIrywHmO3kv5 aSwf9LBmG8Q9aLjNQoaeSZiS3r3kRZzCLA//GHaSrPBAg7CTS/rNHDYckAXptXuAJEmV La05Rxnwv7xfHXxAiT76ZhKjJxO0MEyNNAyyuupHt0AgpgMlrcWcOMkDVh9rcvDyr8OG y4bAhF1ey2SFx3+S/kU8qJWdfu/0IZPpIc8+WA4mcMziRrI6saz8gC3VKfocT6+D7WG4 VrMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=v2oJdrFOTMzFuJyZmPydEjJeGWfpQ6fo0vQCCoqg3sg=; b=i2g8z1r8bt5CH9lrFCBdyoyUhq51YXAWkH0hcC5lE7mRbquu/AJ97PdOxVNnBjqG7+ S9jCKPaP9s/0pYd/CpfqwHXQ7C9ieJ0Oi5cGMKxLPeRrMbWhbLNKj+Q+Zbw9yNwuQHXp su9XrYy1BO+PKdzrlb40i61j9UAXzb/1oLs8XfnL9QwPLO7T9I+brtDMIL/UpiwkGYFM ifITRF3fTvonLwbvAIEMlmm63Dr1u3m49h3NMLeRJE1X0x4I+PhpfXJhqvcvTZc8bp2G htp/QwWm6j4VZnBnhOiW8u4kPERqfGE2wROztSTUuADydCm9klAGKvxw/5r9ih5FMNHf m8WQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 129si398809pfe.140.2019.06.13.12.54.31; Thu, 13 Jun 2019 12:54:46 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729241AbfFMTyS (ORCPT + 99 others); Thu, 13 Jun 2019 15:54:18 -0400 Received: from smtp05.smtpout.orange.fr ([80.12.242.127]:38048 "EHLO smtp.smtpout.orange.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726379AbfFMTyS (ORCPT ); Thu, 13 Jun 2019 15:54:18 -0400 Received: from localhost.localdomain ([92.148.209.44]) by mwinf5d62 with ME id QKuD2000j0y1A8U03KuEMK; Thu, 13 Jun 2019 21:54:16 +0200 X-ME-Helo: localhost.localdomain X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Thu, 13 Jun 2019 21:54:16 +0200 X-ME-IP: 92.148.209.44 From: Christophe JAILLET To: aviad.krawczyk@huawei.com, davem@davemloft.net Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET Subject: [PATCH net-next] hinic: Use devm_kasprintf instead of hard coding it Date: Thu, 13 Jun 2019 21:54:12 +0200 Message-Id: <20190613195412.1702-1-christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 'devm_kasprintf' is less verbose than: snprintf(NULL, 0, ...); devm_kzalloc(...); sprintf so use it instead. Signed-off-by: Christophe JAILLET --- 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; -- 2.20.1