Currently if the allocation for wq fails on the initial iteration in the setup loop the error exit path to err will call put_device on an uninitialized pointer conf_dev. Fix this by initializing conf_dev to NULL, note that put_device will ignore a NULL device pointer so no null pointer dereference issues occur on this call. Fixes: 3fd2f4bc010c ("dmaengine: idxd: fix memory leak in error handling path of idxd_setup_wqs") Signed-off-by: Colin Ian King <colin.i.king@xxxxxxxxx> --- drivers/dma/idxd/init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/dma/idxd/init.c b/drivers/dma/idxd/init.c index 35bdefd3728b..2b61f26af1f6 100644 --- a/drivers/dma/idxd/init.c +++ b/drivers/dma/idxd/init.c @@ -178,7 +178,7 @@ static int idxd_setup_wqs(struct idxd_device *idxd) { struct device *dev = &idxd->pdev->dev; struct idxd_wq *wq; - struct device *conf_dev; + struct device *conf_dev = NULL; int i, rc; idxd->wqs = kcalloc_node(idxd->max_wqs, sizeof(struct idxd_wq *), -- 2.50.1