]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
Fixes for 4.9
authorSasha Levin <sashal@kernel.org>
Sun, 2 Jan 2022 21:57:07 +0000 (16:57 -0500)
committerSasha Levin <sashal@kernel.org>
Sun, 2 Jan 2022 21:57:07 +0000 (16:57 -0500)
Signed-off-by: Sasha Levin <sashal@kernel.org>
queue-4.9/fsl-fman-fix-missing-put_device-call-in-fman_port_pr.patch [new file with mode: 0644]
queue-4.9/series

diff --git a/queue-4.9/fsl-fman-fix-missing-put_device-call-in-fman_port_pr.patch b/queue-4.9/fsl-fman-fix-missing-put_device-call-in-fman_port_pr.patch
new file mode 100644 (file)
index 0000000..6e49187
--- /dev/null
@@ -0,0 +1,82 @@
+From 23746c4626358365c360a5f9a1785a442965a664 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 30 Dec 2021 12:26:27 +0000
+Subject: fsl/fman: Fix missing put_device() call in fman_port_probe
+
+From: Miaoqian Lin <linmq006@gmail.com>
+
+[ Upstream commit bf2b09fedc17248b315f80fb249087b7d28a69a6 ]
+
+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: 18a6c85fcc78 ("fsl/fman: Add FMan Port Support")
+Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/ethernet/freescale/fman/fman_port.c | 12 +++++++-----
+ 1 file changed, 7 insertions(+), 5 deletions(-)
+
+diff --git a/drivers/net/ethernet/freescale/fman/fman_port.c b/drivers/net/ethernet/freescale/fman/fman_port.c
+index 4986f6ba278a3..45ac5cf717ea8 100644
+--- a/drivers/net/ethernet/freescale/fman/fman_port.c
++++ b/drivers/net/ethernet/freescale/fman/fman_port.c
+@@ -1658,7 +1658,7 @@ static int fman_port_probe(struct platform_device *of_dev)
+       fman = dev_get_drvdata(&fm_pdev->dev);
+       if (!fman) {
+               err = -EINVAL;
+-              goto return_err;
++              goto put_device;
+       }
+       err = of_property_read_u32(port_node, "cell-index", &val);
+@@ -1666,7 +1666,7 @@ static int fman_port_probe(struct platform_device *of_dev)
+               dev_err(port->dev, "%s: reading cell-index for %s failed\n",
+                       __func__, port_node->full_name);
+               err = -EINVAL;
+-              goto return_err;
++              goto put_device;
+       }
+       port_id = (u8)val;
+       port->dts_params.id = port_id;
+@@ -1700,7 +1700,7 @@ static int fman_port_probe(struct platform_device *of_dev)
+       }  else {
+               dev_err(port->dev, "%s: Illegal port type\n", __func__);
+               err = -EINVAL;
+-              goto return_err;
++              goto put_device;
+       }
+       port->dts_params.type = port_type;
+@@ -1714,7 +1714,7 @@ static int fman_port_probe(struct platform_device *of_dev)
+                       dev_err(port->dev, "%s: incorrect qman-channel-id\n",
+                               __func__);
+                       err = -EINVAL;
+-                      goto return_err;
++                      goto put_device;
+               }
+               port->dts_params.qman_channel_id = qman_channel_id;
+       }
+@@ -1724,7 +1724,7 @@ static int fman_port_probe(struct platform_device *of_dev)
+               dev_err(port->dev, "%s: of_address_to_resource() failed\n",
+                       __func__);
+               err = -ENOMEM;
+-              goto return_err;
++              goto put_device;
+       }
+       port->dts_params.fman = fman;
+@@ -1749,6 +1749,8 @@ static int fman_port_probe(struct platform_device *of_dev)
+       return 0;
++put_device:
++      put_device(&fm_pdev->dev);
+ return_err:
+       of_node_put(port_node);
+ free_port:
+-- 
+2.34.1
+
index c19936edba9bd605fb0cbd99a2d1ab5830a1f6af..601e5968f29b8a17c699b057fe4944c0e316ff93 100644 (file)
@@ -2,3 +2,4 @@ hid-asus-add-depends-on-usb_hid-to-hid_asus-kconfig-option.patch
 platform-x86-apple-gmux-use-resource_size-with-res.patch
 recordmcount.pl-fix-typo-in-s390-mcount-regex.patch
 selinux-initialize-proto-variable-in-selinux_ip_postroute_compat.patch
+fsl-fman-fix-missing-put_device-call-in-fman_port_pr.patch