Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp1991313pxb; Sun, 18 Apr 2021 14:28:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx/d67wm25YdPPjvQJLnP19hH49ixcpZ48f9s6sgo8k4xxnW3FL/ySNQPcaDFpgT+5JOcSo X-Received: by 2002:a63:697:: with SMTP id 145mr8662034pgg.450.1618781311324; Sun, 18 Apr 2021 14:28:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618781311; cv=none; d=google.com; s=arc-20160816; b=mMIEn1274bqmvqyeePwUlRSGMG1Gjg5pOdRuowJn06sjm4LpkRmgmERsZZ8L19vujK J26EhyZKthdIC+QIyVOV2rGoV2nbWhAzcModXPN/tlVtcvvzz66gZsDRUt0nrBReQ4Sn 3PVIKBVgubRU6GtJjY4TebXoUFJut6ms5fuKcbQejVkx7tCCaRJk5OhEkNKiaCLOzOdY QflbmzLsmB8uUGE3J3jzC/uRKpfo7dtpvUpAieDQaaT8BTA4YXdJNpj/8QFH/XssL6w/ j26oyPwvdLX5Gt9DDgrYhfd2XMB/kmdYNyBxrEsBL95Yu/ZGzHsxIurTwgPNsR9gT7g/ b9mA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=hI0cvEM9S09YhySTd9TvhlN9/f3K5LpVmaQE+u9YH/4=; b=mplLjh+8ARMFRed85GlAlJzNPdeTjwug5k5FHU1i2oedqZShAZk6tHRyYrweGG5foj Z7x+cVQ6CaoAy+J8ab9gBBeiCfnrmbN5+6Vm9GVzSLTKc20a/jTeqsAK3HDSo29gvUIp Nzx0Ao/41RgspBxfV4OqgUynUNUNeZcZG8HhuII7tfBZKb8h3rdFp+2fjnYi6iGl3psa vsUWhhI8T3STosM/6+7sZkN12lk1GtFPbd/xWBDv8drUg5uKoAFUHPXW7cp5sPRzuWVP bA/D/UgtE91jRQQy6tvar/E8J2iciNrhr+xCj2PSoRzTG3MrzJWz1y9THa0082fhd9M+ 4Jmw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 41si14907781plb.404.2021.04.18.14.28.19; Sun, 18 Apr 2021 14:28:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235404AbhDRV1E (ORCPT + 99 others); Sun, 18 Apr 2021 17:27:04 -0400 Received: from smtp02.smtpout.orange.fr ([80.12.242.124]:50238 "EHLO smtp.smtpout.orange.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235484AbhDRV1D (ORCPT ); Sun, 18 Apr 2021 17:27:03 -0400 Received: from localhost.localdomain ([86.243.172.93]) by mwinf5d25 with ME id uMSY2400B21Fzsu03MSZFK; Sun, 18 Apr 2021 23:26:33 +0200 X-ME-Helo: localhost.localdomain X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sun, 18 Apr 2021 23:26:33 +0200 X-ME-IP: 86.243.172.93 From: Christophe JAILLET To: tj@kernel.org, jiangshanlai@gmail.com, saeedm@nvidia.com, leon@kernel.org, davem@davemloft.net, kuba@kernel.org, bvanassche@acm.org Cc: netdev@vger.kernel.org, linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET Subject: [PATCH 2/2] net/mlx5: Simplify workqueue name creation Date: Sun, 18 Apr 2021 23:26:31 +0200 Message-Id: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There is no need to explicitly allocate, populate and free some memory just to pass a workqueue name to 'create_singlethread_workqueue()'. This macro can do all this for us, so keep the code simple. Signed-off-by: Christophe JAILLET --- A similar patch has also been sent. It was replacing the kmalloc/strcpy/ strcat with a kasprintf. Updating 'create_singlethread_workqueue' gives an even more elegant solution. --- drivers/net/ethernet/mellanox/mlx5/core/health.c | 9 +-------- 1 file changed, 2 insertion(+), 8 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/health.c b/drivers/net/ethernet/mellanox/mlx5/core/health.c index 9ff163c5bcde..160f852b7bbe 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/health.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/health.c @@ -797,19 +797,13 @@ void mlx5_health_cleanup(struct mlx5_core_dev *dev) int mlx5_health_init(struct mlx5_core_dev *dev) { struct mlx5_core_health *health; - char *name; mlx5_fw_reporters_create(dev); health = &dev->priv.health; - name = kmalloc(64, GFP_KERNEL); - if (!name) - goto out_err; - strcpy(name, "mlx5_health"); - strcat(name, dev_name(dev->device)); - health->wq = create_singlethread_workqueue(name); - kfree(name); + health->wq = create_singlethread_workqueue("mlx5_health%s", + dev_name(dev->device)); if (!health->wq) goto out_err; spin_lock_init(&health->wq_lock); -- 2.27.0