Thread (2 messages) 2 messages, 2 authors, 2017-12-20

Re: [PATCH] lightnvm: pblk: remove some unnecessary NULL checks

From: Matias Bjørling <hidden>
Date: 2017-12-20 17:30:12
Also in: kernel-janitors

On 11/06/2017 12:48 PM, Dan Carpenter wrote:
quoted hunk ↗ jump to hunk
Smatch complains that flush_workqueue() dereferences the work queue
pointer but then we check if it's NULL on the next line when it's too
late.  These NULL checks can be removed because the module won't load if
we can't allocate the work queues.

Signed-off-by: Dan Carpenter <redacted>
diff --git a/drivers/lightnvm/pblk-gc.c b/drivers/lightnvm/pblk-gc.c
index 00d5698d64a9..aaba2049a135 100644
--- a/drivers/lightnvm/pblk-gc.c
+++ b/drivers/lightnvm/pblk-gc.c
@@ -669,12 +669,10 @@ void pblk_gc_exit(struct pblk *pblk)
  		kthread_stop(gc->gc_reader_ts);
  
  	flush_workqueue(gc->gc_reader_wq);
-	if (gc->gc_reader_wq)
-		destroy_workqueue(gc->gc_reader_wq);
+	destroy_workqueue(gc->gc_reader_wq);
  
  	flush_workqueue(gc->gc_line_reader_wq);
-	if (gc->gc_line_reader_wq)
-		destroy_workqueue(gc->gc_line_reader_wq);
+	destroy_workqueue(gc->gc_line_reader_wq);
  
  	if (gc->gc_writer_ts)
  		kthread_stop(gc->gc_writer_ts);
Thanks Dan. I've applied it for 4.16.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help