Skip to contentSkip to conversation

misc: mic: replace kfree with put_device

PATCH New Geliang Tang 1 participant 1 message Oct 12, 2015 1 message not in the archive Char and misc drivers

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH v3 1/1 misc: mic: replace kfree with put_device

Handle a failed device_register(), replace kfree() with put_device(), which will call cosm/mbus/scif_release_dev().

---
Changes in v3:
- Add the same change to cosm_bus.c
Changes in v2:
- Just refresh this patch.

---
 drivers/misc/mic/bus/cosm_bus.c | 2 +-
 drivers/misc/mic/bus/mic_bus.c  | 2 +-
 drivers/misc/mic/bus/scif_bus.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
drivers/misc/mic/bus/cosm_bus.c +1 -1
index 1e36830..d31d6c6 100644
@@ -100,7 +100,7 @@ cosm_register_device(struct device *pdev, struct cosm_hw_ops *hw_ops)
 ida_remove:
 	ida_simple_remove(&cosm_index_ida, cdev->index);
 free_cdev:
-	kfree(cdev);
+	put_device(&cdev->dev);
 	return ERR_PTR(ret);
 }
 EXPORT_SYMBOL_GPL(cosm_register_device);
drivers/misc/mic/bus/mic_bus.c +1 -1
index c64955d..be37890 100644
@@ -175,7 +175,7 @@ mbus_register_device(struct device *pdev, int id, struct dma_map_ops *dma_ops,
 		goto free_mbdev;
 	return mbdev;
 free_mbdev:
-	kfree(mbdev);
+	put_device(&mbdev->dev);
 	return ERR_PTR(ret);
 }
 EXPORT_SYMBOL_GPL(mbus_register_device);
drivers/misc/mic/bus/scif_bus.c +1 -1
index fd27021..ff6e01c 100644
@@ -180,7 +180,7 @@ scif_register_device(struct device *pdev, int id, struct dma_map_ops *dma_ops,
 		goto free_sdev;
 	return sdev;
 free_sdev:
-	kfree(sdev);
+	put_device(&sdev->dev);
 	return ERR_PTR(ret);
 }
 EXPORT_SYMBOL_GPL(scif_register_device);
Signature · 1 line
1.9.1