Actually the error handling wasn't so bad. It's just that one error path which is buggy. The idxd->max_wqs variable probably can't be <= 0 (I haven't checked, but I assume it can't). Anyway, I've sent my prefered fix but an alternative would be to do the below. regards, dan carpenter diff --git a/drivers/dma/idxd/init.c b/drivers/dma/idxd/init.c index 35bdefd3728b..b603d7dacf3a 100644 --- a/drivers/dma/idxd/init.c +++ b/drivers/dma/idxd/init.c @@ -195,6 +195,7 @@ static int idxd_setup_wqs(struct idxd_device *idxd) for (i = 0; i < idxd->max_wqs; i++) { wq = kzalloc_node(sizeof(*wq), GFP_KERNEL, dev_to_node(dev)); if (!wq) { + conf_dev = NULL; rc = -ENOMEM; goto err; }