mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH next] dm delay: Fix missing error code in delay_ctr()
@ 2023-10-31  7:10 Harshit Mogalapalli
  2023-10-31  9:35 ` Christian Loehle
  0 siblings, 1 reply; 2+ messages in thread
From: Harshit Mogalapalli @ 2023-10-31  7:10 UTC (permalink / raw)
  To: Alasdair Kergon, Mike Snitzer, dm-devel, Christian Loehle, linux-kernel
  Cc: dan.carpenter, kernel-janitors, error27, harshit.m.mogalapalli

When worker thread allocation fails, return error instead of
zero(success).

Also when kthread_create fails it returns ERR pointers and not NULL, so
fix that as well.

Fixes: c1fce71d29b2 ("dm delay: for short delays, use kthread instead of timers and wq")
Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
---
Smatch complained about the missing error code.
This patch is only compile tested.
---
 drivers/md/dm-delay.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/md/dm-delay.c b/drivers/md/dm-delay.c
index 3d91804923eb..efd510984e25 100644
--- a/drivers/md/dm-delay.c
+++ b/drivers/md/dm-delay.c
@@ -280,8 +280,10 @@ static int delay_ctr(struct dm_target *ti, unsigned int argc, char **argv)
 		 */
 		dc->worker = kthread_create(&flush_worker_fn, dc,
 					    "dm-delay-flush-worker");
-		if (!dc->worker)
+		if (IS_ERR(dc->worker)) {
+			ret = PTR_ERR(dc->worker);
 			goto bad;
+		}
 	} else {
 		timer_setup(&dc->delay_timer, handle_delayed_timer, 0);
 		INIT_WORK(&dc->flush_expired_bios, flush_expired_bios);
-- 
2.39.3


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-10-31  9:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-31  7:10 [PATCH next] dm delay: Fix missing error code in delay_ctr() Harshit Mogalapalli
2023-10-31  9:35 ` Christian Loehle

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®