.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * Copyright 2015 IBM Corp. |
---|
3 | | - * |
---|
4 | | - * This program is free software; you can redistribute it and/or |
---|
5 | | - * modify it under the terms of the GNU General Public License |
---|
6 | | - * as published by the Free Software Foundation; either version |
---|
7 | | - * 2 of the License, or (at your option) any later version. |
---|
8 | 4 | */ |
---|
9 | 5 | |
---|
10 | 6 | #include <linux/spinlock.h> |
---|
.. | .. |
---|
963 | 959 | * if it returns an error! |
---|
964 | 960 | */ |
---|
965 | 961 | if ((rc = cxl_register_afu(afu))) |
---|
966 | | - goto err_put1; |
---|
| 962 | + goto err_put_dev; |
---|
967 | 963 | |
---|
968 | 964 | if ((rc = cxl_sysfs_afu_add(afu))) |
---|
969 | | - goto err_put1; |
---|
| 965 | + goto err_del_dev; |
---|
970 | 966 | |
---|
971 | 967 | /* |
---|
972 | 968 | * pHyp doesn't expose the programming models supported by the |
---|
.. | .. |
---|
982 | 978 | afu->modes_supported = CXL_MODE_DIRECTED; |
---|
983 | 979 | |
---|
984 | 980 | if ((rc = cxl_afu_select_best_mode(afu))) |
---|
985 | | - goto err_put2; |
---|
| 981 | + goto err_remove_sysfs; |
---|
986 | 982 | |
---|
987 | 983 | adapter->afu[afu->slice] = afu; |
---|
988 | 984 | |
---|
.. | .. |
---|
1002 | 998 | |
---|
1003 | 999 | return 0; |
---|
1004 | 1000 | |
---|
1005 | | -err_put2: |
---|
| 1001 | +err_remove_sysfs: |
---|
1006 | 1002 | cxl_sysfs_afu_remove(afu); |
---|
1007 | | -err_put1: |
---|
1008 | | - device_unregister(&afu->dev); |
---|
| 1003 | +err_del_dev: |
---|
| 1004 | + device_del(&afu->dev); |
---|
| 1005 | +err_put_dev: |
---|
| 1006 | + put_device(&afu->dev); |
---|
1009 | 1007 | free = false; |
---|
1010 | 1008 | guest_release_serr_irq(afu); |
---|
1011 | 1009 | err2: |
---|
.. | .. |
---|
1139 | 1137 | * even if it returns an error! |
---|
1140 | 1138 | */ |
---|
1141 | 1139 | if ((rc = cxl_register_adapter(adapter))) |
---|
1142 | | - goto err_put1; |
---|
| 1140 | + goto err_put_dev; |
---|
1143 | 1141 | |
---|
1144 | 1142 | if ((rc = cxl_sysfs_adapter_add(adapter))) |
---|
1145 | | - goto err_put1; |
---|
| 1143 | + goto err_del_dev; |
---|
1146 | 1144 | |
---|
1147 | 1145 | /* release the context lock as the adapter is configured */ |
---|
1148 | 1146 | cxl_adapter_context_unlock(adapter); |
---|
1149 | 1147 | |
---|
1150 | 1148 | return adapter; |
---|
1151 | 1149 | |
---|
1152 | | -err_put1: |
---|
1153 | | - device_unregister(&adapter->dev); |
---|
| 1150 | +err_del_dev: |
---|
| 1151 | + device_del(&adapter->dev); |
---|
| 1152 | +err_put_dev: |
---|
| 1153 | + put_device(&adapter->dev); |
---|
1154 | 1154 | free = false; |
---|
1155 | 1155 | cxl_guest_remove_chardev(adapter); |
---|
1156 | 1156 | err1: |
---|