Commit 82ff3ac7 authored by Geliang Tang's avatar Geliang Tang Committed by Greg Kroah-Hartman

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().
Signed-off-by: default avatarGeliang Tang <geliangtang@163.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent f8bf0dec
...@@ -100,7 +100,7 @@ cosm_register_device(struct device *pdev, struct cosm_hw_ops *hw_ops) ...@@ -100,7 +100,7 @@ cosm_register_device(struct device *pdev, struct cosm_hw_ops *hw_ops)
ida_remove: ida_remove:
ida_simple_remove(&cosm_index_ida, cdev->index); ida_simple_remove(&cosm_index_ida, cdev->index);
free_cdev: free_cdev:
kfree(cdev); put_device(&cdev->dev);
return ERR_PTR(ret); return ERR_PTR(ret);
} }
EXPORT_SYMBOL_GPL(cosm_register_device); EXPORT_SYMBOL_GPL(cosm_register_device);
......
...@@ -175,7 +175,7 @@ mbus_register_device(struct device *pdev, int id, struct dma_map_ops *dma_ops, ...@@ -175,7 +175,7 @@ mbus_register_device(struct device *pdev, int id, struct dma_map_ops *dma_ops,
goto free_mbdev; goto free_mbdev;
return mbdev; return mbdev;
free_mbdev: free_mbdev:
kfree(mbdev); put_device(&mbdev->dev);
return ERR_PTR(ret); return ERR_PTR(ret);
} }
EXPORT_SYMBOL_GPL(mbus_register_device); EXPORT_SYMBOL_GPL(mbus_register_device);
......
...@@ -180,7 +180,7 @@ scif_register_device(struct device *pdev, int id, struct dma_map_ops *dma_ops, ...@@ -180,7 +180,7 @@ scif_register_device(struct device *pdev, int id, struct dma_map_ops *dma_ops,
goto free_sdev; goto free_sdev;
return sdev; return sdev;
free_sdev: free_sdev:
kfree(sdev); put_device(&sdev->dev);
return ERR_PTR(ret); return ERR_PTR(ret);
} }
EXPORT_SYMBOL_GPL(scif_register_device); EXPORT_SYMBOL_GPL(scif_register_device);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment