File tree Expand file tree Collapse file tree 1 file changed +8
-8
lines changed
drivers/misc/habanalabs/common Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -231,16 +231,16 @@ static int device_cdev_sysfs_add(struct hl_device *hdev)
231
231
232
232
static void device_cdev_sysfs_del (struct hl_device * hdev )
233
233
{
234
- /* device_release() won't be called so must free devices explicitly */
235
- if (!hdev -> cdev_sysfs_created ) {
236
- kfree (hdev -> dev_ctrl );
237
- kfree (hdev -> dev );
238
- return ;
239
- }
234
+ if (!hdev -> cdev_sysfs_created )
235
+ goto put_devices ;
240
236
241
237
hl_sysfs_fini (hdev );
242
238
cdev_device_del (& hdev -> cdev_ctrl , hdev -> dev_ctrl );
243
239
cdev_device_del (& hdev -> cdev , hdev -> dev );
240
+
241
+ put_devices :
242
+ put_device (hdev -> dev );
243
+ put_device (hdev -> dev_ctrl );
244
244
}
245
245
246
246
/*
@@ -1371,9 +1371,9 @@ int hl_device_init(struct hl_device *hdev, struct class *hclass)
1371
1371
early_fini :
1372
1372
device_early_fini (hdev );
1373
1373
free_dev_ctrl :
1374
- kfree (hdev -> dev_ctrl );
1374
+ put_device (hdev -> dev_ctrl );
1375
1375
free_dev :
1376
- kfree (hdev -> dev );
1376
+ put_device (hdev -> dev );
1377
1377
out_disabled :
1378
1378
hdev -> disabled = true;
1379
1379
if (add_cdev_sysfs_on_err )
You can’t perform that action at this time.
0 commit comments