From b9d41052794385f9d47ebb7acf4a772f3ad02398 Mon Sep 17 00:00:00 2001 From: Namhyung Kim Date: Mon, 13 Dec 2010 13:42:24 -0600 Subject: [PATCH] dlm: sanitize work_start() in lowcomms.c The create_workqueue() returns NULL if failed rather than ERR_PTR(). Fix error checking and remove unnecessary variable 'error'. Signed-off-by: Namhyung Kim Cc: Tejun Heo Signed-off-by: David Teigland --- fs/dlm/lowcomms.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c index 0e75f152eac2..9c64ae9e4c1a 100644 --- a/fs/dlm/lowcomms.c +++ b/fs/dlm/lowcomms.c @@ -1468,22 +1468,19 @@ static void work_stop(void) static int work_start(void) { - int error; recv_workqueue = alloc_workqueue("dlm_recv", WQ_MEM_RECLAIM | WQ_HIGHPRI | WQ_FREEZEABLE, 0); - error = IS_ERR(recv_workqueue); - if (error) { - log_print("can't start dlm_recv %d", error); - return error; + if (!recv_workqueue) { + log_print("can't start dlm_recv"); + return -ENOMEM; } send_workqueue = alloc_workqueue("dlm_send", WQ_MEM_RECLAIM | WQ_HIGHPRI | WQ_FREEZEABLE, 0); - error = IS_ERR(send_workqueue); - if (error) { - log_print("can't start dlm_send %d", error); + if (!send_workqueue) { + log_print("can't start dlm_send"); destroy_workqueue(recv_workqueue); - return error; + return -ENOMEM; } return 0;