Commit 4d34c926 authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab

media: tegra_cec: use new cec_notifier_parse_hdmi_phandle helper

The Tegra 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>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
parent e3a7c52d
...@@ -327,21 +327,15 @@ static const struct cec_adap_ops tegra_cec_ops = { ...@@ -327,21 +327,15 @@ static const struct cec_adap_ops tegra_cec_ops = {
static int tegra_cec_probe(struct platform_device *pdev) static int tegra_cec_probe(struct platform_device *pdev)
{ {
struct platform_device *hdmi_dev; struct device *hdmi_dev;
struct device_node *np;
struct tegra_cec *cec; struct tegra_cec *cec;
struct resource *res; struct resource *res;
int ret = 0; int ret = 0;
np = of_parse_phandle(pdev->dev.of_node, "hdmi-phandle", 0); hdmi_dev = cec_notifier_parse_hdmi_phandle(&pdev->dev);
if (!np) { if (!hdmi_dev)
dev_err(&pdev->dev, "Failed to find hdmi node in device tree\n");
return -ENODEV; return -ENODEV;
}
hdmi_dev = of_find_device_by_node(np);
if (hdmi_dev == NULL)
return -EPROBE_DEFER;
cec = devm_kzalloc(&pdev->dev, sizeof(struct tegra_cec), GFP_KERNEL); cec = devm_kzalloc(&pdev->dev, sizeof(struct tegra_cec), GFP_KERNEL);
...@@ -400,7 +394,7 @@ static int tegra_cec_probe(struct platform_device *pdev) ...@@ -400,7 +394,7 @@ static int tegra_cec_probe(struct platform_device *pdev)
goto clk_error; goto clk_error;
} }
cec->notifier = cec_notifier_get(&hdmi_dev->dev); cec->notifier = cec_notifier_get(hdmi_dev);
if (!cec->notifier) { if (!cec->notifier) {
ret = -ENOMEM; ret = -ENOMEM;
goto clk_error; goto clk_error;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment