mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-08 21:22:09 -04:00
media: rcar_drif: Fix fwnode reference leak when parsing DT
[ Upstream commit cdd4f7824994c9254acc6e415750529ea2d2cfe0 ] The fwnode reference corresponding to the endpoint is leaked in an error path of the rcar_drif_parse_subdevs() function. Fix it, and reorganize fwnode reference handling in the function to release references early, simplifying error paths. Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
79ec0578c7
commit
58e2bcb7fa
1 changed files with 5 additions and 11 deletions
|
|
@ -1223,28 +1223,22 @@ static int rcar_drif_parse_subdevs(struct rcar_drif_sdr *sdr)
|
|||
if (!ep)
|
||||
return 0;
|
||||
|
||||
/* Get the endpoint properties */
|
||||
rcar_drif_get_ep_properties(sdr, ep);
|
||||
|
||||
fwnode = fwnode_graph_get_remote_port_parent(ep);
|
||||
fwnode_handle_put(ep);
|
||||
if (!fwnode) {
|
||||
dev_warn(sdr->dev, "bad remote port parent\n");
|
||||
fwnode_handle_put(ep);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
sdr->ep.asd.match.fwnode = fwnode;
|
||||
sdr->ep.asd.match_type = V4L2_ASYNC_MATCH_FWNODE;
|
||||
ret = v4l2_async_notifier_add_subdev(notifier, &sdr->ep.asd);
|
||||
if (ret) {
|
||||
fwnode_handle_put(fwnode);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Get the endpoint properties */
|
||||
rcar_drif_get_ep_properties(sdr, ep);
|
||||
|
||||
fwnode_handle_put(fwnode);
|
||||
fwnode_handle_put(ep);
|
||||
|
||||
return 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Check if the given device is the primary bond */
|
||||
|
|
|
|||
Loading…
Reference in a new issue