Thread (9 messages) 9 messages, 3 authors, 2020-11-09

Re: [PATCH] fsl/fman: add missing put_devcie() call in fman_port_probe()

From: yukuai (C) <hidden>
Date: 2020-11-03 11:09:19
Also in: lkml

On 2020/11/03 9:30, Jakub Kicinski wrote:
On Sat, 31 Oct 2020 18:54:18 +0800 Yu Kuai wrote:
quoted
if of_find_device_by_node() succeed, fman_port_probe() doesn't have a
corresponding put_device(). Thus add jump target to fix the exception
handling for this function implementation.

Fixes: 0572054617f3 ("fsl/fman: fix dereference null return value")
Signed-off-by: Yu Kuai <redacted>
quoted
diff --git a/drivers/net/ethernet/freescale/fman/fman_port.c b/drivers/net/ethernet/freescale/fman/fman_port.c
index d9baac0dbc7d..576ce6df3fce 100644
--- a/drivers/net/ethernet/freescale/fman/fman_port.c
+++ b/drivers/net/ethernet/freescale/fman/fman_port.c
@@ -1799,13 +1799,13 @@ static int fman_port_probe(struct platform_device *of_dev)
  	of_node_put(fm_node);
  	if (!fm_pdev) {
  		err = -EINVAL;
-		goto return_err;
+		goto put_device;
  	}
quoted
@@ -1898,6 +1898,8 @@ static int fman_port_probe(struct platform_device *of_dev)
  
  return_err:
  	of_node_put(port_node);
+put_device:
+	put_device(&fm_pdev->dev);
  free_port:
  	kfree(port);
  	return err;
This does not look right. You're jumping to put_device() when fm_pdev
is NULL?
Hi,

oops, it's a silly mistake. Will fix it in V2 patch.

Thanks,
Yu Kuai
The order of error handling should be the reverse of the order of
execution of the function.
.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help