From 474cca5fd894de99afc69274e8b25524ae62d7ee Mon Sep 17 00:00:00 2001 From: Arvind Yadav Date: Mon, 12 Mar 2018 17:06:53 +0530 Subject: [PATCH] misc: ocxl: use put_device() instead of device_unregister() MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit if device_register() returned an error! Always use put_device() to give up the reference initialized. Signed-off-by: Arvind Yadav Reviewed-by: Uwe Kleine-König Acked-by: Andrew Donnellan Signed-off-by: Greg Kroah-Hartman --- drivers/misc/ocxl/pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/misc/ocxl/pci.c b/drivers/misc/ocxl/pci.c index 0051d9e..21f4254 100644 --- a/drivers/misc/ocxl/pci.c +++ b/drivers/misc/ocxl/pci.c @@ -519,7 +519,7 @@ static struct ocxl_fn *init_function(struct pci_dev *dev) rc = device_register(&fn->dev); if (rc) { deconfigure_function(fn); - device_unregister(&fn->dev); + put_device(&fn->dev); return ERR_PTR(rc); } return fn; -- 2.7.4