dlm: sanitize work_start() in lowcomms.c
PATCH 1/1 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 <[email protected]>
Cc Tejun Heo <[email protected]>
--- fs/dlm/lowcomms.c | 16 +++++++--------- 1 files changed, 7 insertions(+), 9 deletions(-)
fs/dlm/lowcomms.c +7 -9
@@ -1430,20 +1430,18 @@ static void work_stop(void)static int work_start (void ) { -int error; recv_workqueue =create_workqueue ("dlm_recv" ); - 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 =create_singlethread_workqueue ("dlm_send" ); - 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; + recv_workqueue =NULL ; +return -ENOMEM ; }return 0 ;
Signature · 1 line
1.7.3.3.400.g93cef
David Teigland
maintainerQuoted 2 lines · Namhyung Kim
The
create_workqueue()returns NULL if failed rather thanERR_PTR(). Fix error checking and remove unnecessary variable 'error'.
I adapted this to the alloc_workqueue patch in next and pushed to next. Dave