Message ID | a32dccb98017715d54853ac2e2aee360851539ce.1618780558.git.christophe.jaillet@wanadoo.fr (mailing list archive) |
---|---|
State | Not Applicable |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | workqueue: Have 'alloc_workqueue()' like macros accept a format specifier | expand |
Context | Check | Description |
---|---|---|
netdev/cover_letter | success | Link |
netdev/fixes_present | success | Link |
netdev/patch_count | success | Link |
netdev/tree_selection | success | Guessed tree name to be net-next |
netdev/subject_prefix | success | Link |
netdev/cc_maintainers | success | CCed 6 of 6 maintainers |
netdev/source_inline | success | Was 0 now: 0 |
netdev/verify_signedoff | success | Link |
netdev/module_param | success | Was 0 now: 0 |
netdev/build_32bit | success | Errors and warnings before: 0 this patch: 0 |
netdev/kdoc | success | Errors and warnings before: 0 this patch: 0 |
netdev/verify_fixes | success | Link |
netdev/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 21 lines checked |
netdev/build_allmodconfig_warn | success | Errors and warnings before: 0 this patch: 0 |
netdev/header_inline | success | Link |
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);
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 <christophe.jaillet@wanadoo.fr> --- 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(-)