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>
This commit is contained in:
parent
5fbe9f35df
commit
474cca5fd8
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue