Commit bf2b09fe authored by Miaoqian Lin's avatar Miaoqian Lin Committed by David S. Miller

fsl/fman: Fix missing put_device() call in fman_port_probe

The reference taken by 'of_find_device_by_node()' must be released when
not needed anymore.
Add the corresponding 'put_device()' in the and error handling paths.

Fixes: 18a6c85f ("fsl/fman: Add FMan Port Support")
Signed-off-by: default avatarMiaoqian Lin <linmq006@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 8b3170e0
...@@ -1805,7 +1805,7 @@ static int fman_port_probe(struct platform_device *of_dev) ...@@ -1805,7 +1805,7 @@ static int fman_port_probe(struct platform_device *of_dev)
fman = dev_get_drvdata(&fm_pdev->dev); fman = dev_get_drvdata(&fm_pdev->dev);
if (!fman) { if (!fman) {
err = -EINVAL; err = -EINVAL;
goto return_err; goto put_device;
} }
err = of_property_read_u32(port_node, "cell-index", &val); err = of_property_read_u32(port_node, "cell-index", &val);
...@@ -1813,7 +1813,7 @@ static int fman_port_probe(struct platform_device *of_dev) ...@@ -1813,7 +1813,7 @@ static int fman_port_probe(struct platform_device *of_dev)
dev_err(port->dev, "%s: reading cell-index for %pOF failed\n", dev_err(port->dev, "%s: reading cell-index for %pOF failed\n",
__func__, port_node); __func__, port_node);
err = -EINVAL; err = -EINVAL;
goto return_err; goto put_device;
} }
port_id = (u8)val; port_id = (u8)val;
port->dts_params.id = port_id; port->dts_params.id = port_id;
...@@ -1847,7 +1847,7 @@ static int fman_port_probe(struct platform_device *of_dev) ...@@ -1847,7 +1847,7 @@ static int fman_port_probe(struct platform_device *of_dev)
} else { } else {
dev_err(port->dev, "%s: Illegal port type\n", __func__); dev_err(port->dev, "%s: Illegal port type\n", __func__);
err = -EINVAL; err = -EINVAL;
goto return_err; goto put_device;
} }
port->dts_params.type = port_type; port->dts_params.type = port_type;
...@@ -1861,7 +1861,7 @@ static int fman_port_probe(struct platform_device *of_dev) ...@@ -1861,7 +1861,7 @@ static int fman_port_probe(struct platform_device *of_dev)
dev_err(port->dev, "%s: incorrect qman-channel-id\n", dev_err(port->dev, "%s: incorrect qman-channel-id\n",
__func__); __func__);
err = -EINVAL; err = -EINVAL;
goto return_err; goto put_device;
} }
port->dts_params.qman_channel_id = qman_channel_id; port->dts_params.qman_channel_id = qman_channel_id;
} }
...@@ -1871,7 +1871,7 @@ static int fman_port_probe(struct platform_device *of_dev) ...@@ -1871,7 +1871,7 @@ static int fman_port_probe(struct platform_device *of_dev)
dev_err(port->dev, "%s: of_address_to_resource() failed\n", dev_err(port->dev, "%s: of_address_to_resource() failed\n",
__func__); __func__);
err = -ENOMEM; err = -ENOMEM;
goto return_err; goto put_device;
} }
port->dts_params.fman = fman; port->dts_params.fman = fman;
...@@ -1896,6 +1896,8 @@ static int fman_port_probe(struct platform_device *of_dev) ...@@ -1896,6 +1896,8 @@ static int fman_port_probe(struct platform_device *of_dev)
return 0; return 0;
put_device:
put_device(&fm_pdev->dev);
return_err: return_err:
of_node_put(port_node); of_node_put(port_node);
free_port: free_port:
......
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