aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/infiniband/core/user_mad.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/drivers/infiniband/core/user_mad.c b/drivers/infiniband/core/user_mad.c
index 52ebb1711d14..0204a4fefd13 100644
--- a/drivers/infiniband/core/user_mad.c
+++ b/drivers/infiniband/core/user_mad.c
@@ -1244,17 +1244,11 @@ static void ib_umad_kill_port(struct ib_umad_port *port)
1244 struct ib_umad_file *file; 1244 struct ib_umad_file *file;
1245 int id; 1245 int id;
1246 1246
1247 dev_set_drvdata(port->dev, NULL);
1248 dev_set_drvdata(port->sm_dev, NULL);
1249
1250 device_destroy(&umad_class, port->cdev.dev);
1251 device_destroy(&umad_class, port->sm_cdev.dev);
1252
1253 cdev_del(&port->cdev);
1254 cdev_del(&port->sm_cdev);
1255
1256 mutex_lock(&port->file_mutex); 1247 mutex_lock(&port->file_mutex);
1257 1248
1249 /* Mark ib_dev NULL and block ioctl or other file ops to progress
1250 * further.
1251 */
1258 port->ib_dev = NULL; 1252 port->ib_dev = NULL;
1259 1253
1260 list_for_each_entry(file, &port->file_list, port_list) { 1254 list_for_each_entry(file, &port->file_list, port_list) {
@@ -1268,6 +1262,16 @@ static void ib_umad_kill_port(struct ib_umad_port *port)
1268 } 1262 }
1269 1263
1270 mutex_unlock(&port->file_mutex); 1264 mutex_unlock(&port->file_mutex);
1265
1266 dev_set_drvdata(port->dev, NULL);
1267 dev_set_drvdata(port->sm_dev, NULL);
1268
1269 device_destroy(&umad_class, port->cdev.dev);
1270 device_destroy(&umad_class, port->sm_cdev.dev);
1271
1272 cdev_del(&port->cdev);
1273 cdev_del(&port->sm_cdev);
1274
1271 ida_free(&umad_ida, port->dev_num); 1275 ida_free(&umad_ida, port->dev_num);
1272} 1276}
1273 1277