[PATCH] remoteproc: qcom_wcnss_iris: Add missing put_device() on error in probe

Dan Carpenter posted 1 patch 1 week, 1 day ago
drivers/remoteproc/qcom_wcnss_iris.c | 2 ++
1 file changed, 2 insertions(+)
[PATCH] remoteproc: qcom_wcnss_iris: Add missing put_device() on error in probe
Posted by Dan Carpenter 1 week, 1 day ago
The device_del() call matches with the device_add() but we also need
to call put_device() to trigger the qcom_iris_release().

Fixes: 1fcef985c8bd ("remoteproc: qcom: wcnss: Fix race with iris probe")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
This patch is based on static analysis and has not been tested.  Please
review carefully, etc.  Another option would be to call device_unregister()

 drivers/remoteproc/qcom_wcnss_iris.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/remoteproc/qcom_wcnss_iris.c b/drivers/remoteproc/qcom_wcnss_iris.c
index b989718776bd..2b52b403eb3f 100644
--- a/drivers/remoteproc/qcom_wcnss_iris.c
+++ b/drivers/remoteproc/qcom_wcnss_iris.c
@@ -196,6 +196,7 @@ struct qcom_iris *qcom_iris_probe(struct device *parent, bool *use_48mhz_xo)
 
 err_device_del:
 	device_del(&iris->dev);
+	put_device(&iris->dev);
 
 	return ERR_PTR(ret);
 }
@@ -203,4 +204,5 @@ struct qcom_iris *qcom_iris_probe(struct device *parent, bool *use_48mhz_xo)
 void qcom_iris_remove(struct qcom_iris *iris)
 {
 	device_del(&iris->dev);
+	put_device(&iris->dev);
 }
-- 
2.47.2
Re: [PATCH] remoteproc: qcom_wcnss_iris: Add missing put_device() on error in probe
Posted by Dmitry Baryshkov 1 week ago
On Wed, Apr 02, 2025 at 01:59:51PM +0300, Dan Carpenter wrote:
> The device_del() call matches with the device_add() but we also need
> to call put_device() to trigger the qcom_iris_release().
> 
> Fixes: 1fcef985c8bd ("remoteproc: qcom: wcnss: Fix race with iris probe")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
> This patch is based on static analysis and has not been tested.  Please
> review carefully, etc.  Another option would be to call device_unregister()
> 
>  drivers/remoteproc/qcom_wcnss_iris.c | 2 ++
>  1 file changed, 2 insertions(+)
> 

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>

-- 
With best wishes
Dmitry