lkml.org 
[lkml]   [2020]   [Nov]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH V3] fsl/fman: add missing put_devcie() call in fman_port_probe()
On Sat, 7 Nov 2020 17:09:25 +0800 Yu Kuai wrote:
> 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 <yukuai3@huawei.com>

> @@ -1792,20 +1792,20 @@ static int fman_port_probe(struct platform_device *of_dev)
> if (!fm_node) {
> dev_err(port->dev, "%s: of_get_parent() failed\n", __func__);
> err = -ENODEV;
> - goto return_err;
> + goto free_port;

And now you no longer put port_node if jumping from here...

Also does the reference to put_device() not have to be released when
this function succeeds?

> }

> @@ -1896,7 +1895,9 @@ static int fman_port_probe(struct platform_device *of_dev)
>
> return 0;
>
> -return_err:
> +put_device:
> + put_device(&fm_pdev->dev);
> +put_node:
> of_node_put(port_node);
> free_port:
> kfree(port);

\
 
 \ /
  Last update: 2020-11-07 23:11    [W:0.141 / U:1.796 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site