Skip to content
Snippets Groups Projects
Commit e3a7c52d authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab
Browse files

media: stih_cec: use new cec_notifier_parse_hdmi_phandle helper


The STI CEC driver increased the HDMI device refcount when
it shouldn't. Use the new helper function to ensure that that
doesn't happen and to simplify the driver code.

Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Acked-by: default avatarBenjamin Gaignard <benjamin.gaignard@linaro.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
parent ba9db909
No related branches found
No related tags found
No related merge requests found
...@@ -301,26 +301,19 @@ static int stih_cec_probe(struct platform_device *pdev) ...@@ -301,26 +301,19 @@ static int stih_cec_probe(struct platform_device *pdev)
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
struct resource *res; struct resource *res;
struct stih_cec *cec; struct stih_cec *cec;
struct device_node *np; struct device *hdmi_dev;
struct platform_device *hdmi_dev;
int ret; int ret;
hdmi_dev = cec_notifier_parse_hdmi_phandle(dev);
if (IS_ERR(hdmi_dev))
return PTR_ERR(hdmi_dev);
cec = devm_kzalloc(dev, sizeof(*cec), GFP_KERNEL); cec = devm_kzalloc(dev, sizeof(*cec), GFP_KERNEL);
if (!cec) if (!cec)
return -ENOMEM; return -ENOMEM;
np = of_parse_phandle(pdev->dev.of_node, "hdmi-phandle", 0); cec->notifier = cec_notifier_get(hdmi_dev);
if (!np) {
dev_err(&pdev->dev, "Failed to find hdmi node in device tree\n");
return -ENODEV;
}
hdmi_dev = of_find_device_by_node(np);
if (!hdmi_dev)
return -EPROBE_DEFER;
cec->notifier = cec_notifier_get(&hdmi_dev->dev);
if (!cec->notifier) if (!cec->notifier)
return -ENOMEM; return -ENOMEM;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment