aboutsummaryrefslogtreecommitdiff
path: root/drivers/rpmsg/qcom_glink_smem.c
diff options
context:
space:
mode:
authorArvind Yadav <arvind.yadav.cs@gmail.com>2018-03-08 15:06:07 +0530
committerBjorn Andersson <bjorn.andersson@linaro.org>2018-03-17 21:45:57 -0700
commita9011726c4bb37e5d6a7279bf47fcc19cd9d3e1a (patch)
treef85ce090085c45c50f2c6f895a2f2c3861d98794 /drivers/rpmsg/qcom_glink_smem.c
parent7928b2cbe55b2a410a0f5c1f154610059c57b1b2 (diff)
downloadlinux-a9011726c4bb37e5d6a7279bf47fcc19cd9d3e1a.tar.gz
rpmsg: glink: use put_device() if device_register fail
if device_register() returned an error! Always use put_device() to give up the reference initialized. And unregister device for other return error. Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Diffstat (limited to 'drivers/rpmsg/qcom_glink_smem.c')
-rw-r--r--drivers/rpmsg/qcom_glink_smem.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/rpmsg/qcom_glink_smem.c b/drivers/rpmsg/qcom_glink_smem.c
index 892f2b92a4d8..3fa9d43e2c87 100644
--- a/drivers/rpmsg/qcom_glink_smem.c
+++ b/drivers/rpmsg/qcom_glink_smem.c
@@ -217,6 +217,7 @@ struct qcom_glink *qcom_glink_smem_register(struct device *parent,
ret = device_register(dev);
if (ret) {
pr_err("failed to register glink edge\n");
+ put_device(dev);
return ERR_PTR(ret);
}
@@ -299,7 +300,7 @@ struct qcom_glink *qcom_glink_smem_register(struct device *parent,
return glink;
err_put_dev:
- put_device(dev);
+ device_unregister(dev);
return ERR_PTR(ret);
}