diff options
author | Arvind Yadav <arvind.yadav.cs@gmail.com> | 2018-03-12 07:36:53 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-03-15 13:12:01 -0400 |
commit | 474cca5fd894de99afc69274e8b25524ae62d7ee (patch) | |
tree | 1ac5e0eb1ac393bc7a6e13457e9e2d9a2d906ff8 | |
parent | 5fbe9f35dfcd83d94ec9bf4f68a9e0d7cc0550b5 (diff) |
misc: ocxl: use put_device() instead of device_unregister()
if device_register() returned an error! Always use put_device()
to give up the reference initialized.
Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Reviewed-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Acked-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/misc/ocxl/pci.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/misc/ocxl/pci.c b/drivers/misc/ocxl/pci.c index 0051d9ec76cc..21f425472a82 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) | |||
519 | rc = device_register(&fn->dev); | 519 | rc = device_register(&fn->dev); |
520 | if (rc) { | 520 | if (rc) { |
521 | deconfigure_function(fn); | 521 | deconfigure_function(fn); |
522 | device_unregister(&fn->dev); | 522 | put_device(&fn->dev); |
523 | return ERR_PTR(rc); | 523 | return ERR_PTR(rc); |
524 | } | 524 | } |
525 | return fn; | 525 | return fn; |