Skip to content

Commit 769d7fb

Browse files
Benjamin-Blockmartinkpetersen
authored andcommitted
scsi: zfcp: Simplify workqueue allocation
alloc_ordered_workqueue() accepts a format string and format arguments as part of the call, so there is no need for the indirection of first using snprintf() to print the name into an local array, and then passing that array to the allocation call. Also make the error-/non-error-case handling more canonical in that the error case is tested in the 'if' that follows the allocation call, and the default return value of the function is '0'. Signed-off-by: Benjamin Block <[email protected]> Reviewed-by: Fedor Loshakov <[email protected]> Reviewed-by: Steffen Maier <[email protected]> Reviewed-by: M Nikhil <[email protected]> Reviewed-by: Nihar Panda <[email protected]> Signed-off-by: Nihar Panda <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 4a9a7c8 commit 769d7fb

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

drivers/s390/scsi/zfcp_aux.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -312,15 +312,13 @@ static void zfcp_print_sl(struct seq_file *m, struct service_level *sl)
312312

313313
static int zfcp_setup_adapter_work_queue(struct zfcp_adapter *adapter)
314314
{
315-
char name[TASK_COMM_LEN];
316-
317-
snprintf(name, sizeof(name), "zfcp_q_%s",
318-
dev_name(&adapter->ccw_device->dev));
319-
adapter->work_queue = alloc_ordered_workqueue(name, WQ_MEM_RECLAIM);
315+
adapter->work_queue =
316+
alloc_ordered_workqueue("zfcp_q_%s", WQ_MEM_RECLAIM,
317+
dev_name(&adapter->ccw_device->dev));
318+
if (!adapter->work_queue)
319+
return -ENOMEM;
320320

321-
if (adapter->work_queue)
322-
return 0;
323-
return -ENOMEM;
321+
return 0;
324322
}
325323

326324
static void zfcp_destroy_adapter_work_queue(struct zfcp_adapter *adapter)

0 commit comments

Comments
 (0)