Skip to content

Commit

Permalink
dlm: sanitize work_start() in lowcomms.c
Browse files Browse the repository at this point in the history
The create_workqueue() returns NULL if failed rather than ERR_PTR().
Fix error checking and remove unnecessary variable 'error'.

Signed-off-by: Namhyung Kim <namhyung@gmail.com>
Cc: Tejun Heo <tj@kernel.org>
Signed-off-by: David Teigland <teigland@redhat.com>
  • Loading branch information
Namhyung Kim authored and David Teigland committed Dec 13, 2010
1 parent f92c8dd commit b9d4105
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions fs/dlm/lowcomms.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit b9d4105

Please sign in to comment.