From: Christophe JAILLET Date: Fri, 25 Nov 2022 17:45:02 +0000 (+0100) Subject: misc: fastrpc: Fix an error handling path in fastrpc_rpmsg_probe() X-Git-Tag: v6.6.17~5454^2~50 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=11819ed2b70da94acc41fec34178a011c4d3d25d;p=platform%2Fkernel%2Flinux-rpi.git misc: fastrpc: Fix an error handling path in fastrpc_rpmsg_probe() If of_platform_populate() fails, some resources need to be freed as already done in the other error handling paths. Fixes: 278d56f970ae ("misc: fastrpc: Reference count channel context") Fixes: 3abe3ab3cdab ("misc: fastrpc: add secure domain support") Signed-off-by: Christophe JAILLET Link: https://lore.kernel.org/r/b909d2f3273b794ea0f1f78d14bc24affb08ea5f.1669398274.git.christophe.jaillet@wanadoo.fr Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c index c9902a1..1413f5cd 100644 --- a/drivers/misc/fastrpc.c +++ b/drivers/misc/fastrpc.c @@ -2316,7 +2316,18 @@ static int fastrpc_rpmsg_probe(struct rpmsg_device *rpdev) data->domain_id = domain_id; data->rpdev = rpdev; - return of_platform_populate(rdev->of_node, NULL, NULL, rdev); + err = of_platform_populate(rdev->of_node, NULL, NULL, rdev); + if (err) + goto populate_error; + + return 0; + +populate_error: + if (data->fdevice) + misc_deregister(&data->fdevice->miscdev); + if (data->secure_fdevice) + misc_deregister(&data->secure_fdevice->miscdev); + fdev_error: kfree(data); return err;