mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-11-30 15:53:22 -05:00
rpmsg: core: Clean up resources on announce_create failure.
commit 8066c615cb69b7da8a94f59379847b037b3a5e46 upstream.
During the rpmsg_dev_probe, if rpdev->ops->announce_create returns an
error, the rpmsg device and default endpoint should be freed before
exiting the function.
Fixes: 5e619b4867 ("rpmsg: Split rpmsg core and virtio backend")
Suggested-by: Bjorn Andersson <[email protected]>
Signed-off-by: Arnaud Pouliquen <[email protected]>
Reviewed-by: Bjorn Andersson <[email protected]>
Cc: stable <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Mathieu Poirier <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
This commit is contained in:
parent
9e2c8bd784
commit
b728b5295d
1 changed files with 16 additions and 4 deletions
|
|
@ -473,13 +473,25 @@ static int rpmsg_dev_probe(struct device *dev)
|
|||
err = rpdrv->probe(rpdev);
|
||||
if (err) {
|
||||
dev_err(dev, "%s: failed: %d\n", __func__, err);
|
||||
if (ept)
|
||||
rpmsg_destroy_ept(ept);
|
||||
goto out;
|
||||
goto destroy_ept;
|
||||
}
|
||||
|
||||
if (ept && rpdev->ops->announce_create)
|
||||
if (ept && rpdev->ops->announce_create) {
|
||||
err = rpdev->ops->announce_create(rpdev);
|
||||
if (err) {
|
||||
dev_err(dev, "failed to announce creation\n");
|
||||
goto remove_rpdev;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
remove_rpdev:
|
||||
if (rpdrv->remove)
|
||||
rpdrv->remove(rpdev);
|
||||
destroy_ept:
|
||||
if (ept)
|
||||
rpmsg_destroy_ept(ept);
|
||||
out:
|
||||
return err;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue