Skip to content

Commit bf2b09f

Browse files
Yuuoniydavem330
authored andcommitted
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: 18a6c85 ("fsl/fman: Add FMan Port Support") Signed-off-by: Miaoqian Lin <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 8b3170e commit bf2b09f

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

drivers/net/ethernet/freescale/fman/fman_port.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1805,15 +1805,15 @@ static int fman_port_probe(struct platform_device *of_dev)
18051805
fman = dev_get_drvdata(&fm_pdev->dev);
18061806
if (!fman) {
18071807
err = -EINVAL;
1808-
goto return_err;
1808+
goto put_device;
18091809
}
18101810

18111811
err = of_property_read_u32(port_node, "cell-index", &val);
18121812
if (err) {
18131813
dev_err(port->dev, "%s: reading cell-index for %pOF failed\n",
18141814
__func__, port_node);
18151815
err = -EINVAL;
1816-
goto return_err;
1816+
goto put_device;
18171817
}
18181818
port_id = (u8)val;
18191819
port->dts_params.id = port_id;
@@ -1847,7 +1847,7 @@ static int fman_port_probe(struct platform_device *of_dev)
18471847
} else {
18481848
dev_err(port->dev, "%s: Illegal port type\n", __func__);
18491849
err = -EINVAL;
1850-
goto return_err;
1850+
goto put_device;
18511851
}
18521852

18531853
port->dts_params.type = port_type;
@@ -1861,7 +1861,7 @@ static int fman_port_probe(struct platform_device *of_dev)
18611861
dev_err(port->dev, "%s: incorrect qman-channel-id\n",
18621862
__func__);
18631863
err = -EINVAL;
1864-
goto return_err;
1864+
goto put_device;
18651865
}
18661866
port->dts_params.qman_channel_id = qman_channel_id;
18671867
}
@@ -1871,7 +1871,7 @@ static int fman_port_probe(struct platform_device *of_dev)
18711871
dev_err(port->dev, "%s: of_address_to_resource() failed\n",
18721872
__func__);
18731873
err = -ENOMEM;
1874-
goto return_err;
1874+
goto put_device;
18751875
}
18761876

18771877
port->dts_params.fman = fman;
@@ -1896,6 +1896,8 @@ static int fman_port_probe(struct platform_device *of_dev)
18961896

18971897
return 0;
18981898

1899+
put_device:
1900+
put_device(&fm_pdev->dev);
18991901
return_err:
19001902
of_node_put(port_node);
19011903
free_port:

0 commit comments

Comments
 (0)