lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Thu, 21 Jan 2021 16:31:18 +0100
From:   Antoine Tenart <atenart@...nel.org>
To:     Pan Bian <bianpan2016@....com>,
        Philipp Zabel <p.zabel@...gutronix.de>,
        Sebastian Hesselbarth <sebastian.hesselbarth@...il.com>
Cc:     linux-kernel@...r.kernel.org, Pan Bian <bianpan2016@....com>
Subject: Re: [PATCH] reset: berlin: Put parent device node on error path

Hello,

Quoting Pan Bian (2021-01-21 16:11:26)
> Put parent device node parent_np if there is no enough memory.
> 
> Fixes: aed6f3cadc86 ("reset: berlin: convert to a platform driver")
> Signed-off-by: Pan Bian <bianpan2016@....com>
> ---
>  drivers/reset/reset-berlin.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/reset/reset-berlin.c b/drivers/reset/reset-berlin.c
> index 371197bbd055..cae58e40f639 100644
> --- a/drivers/reset/reset-berlin.c
> +++ b/drivers/reset/reset-berlin.c
> @@ -72,8 +72,10 @@ static int berlin2_reset_probe(struct platform_device *pdev)
>         struct berlin_reset_priv *priv;
>  
>         priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
> -       if (!priv)
> +       if (!priv) {
> +               of_node_put(parent_np);
>                 return -ENOMEM;
> +       }

You could also move the of_get_parent() call here, to avoid having to
handle parent_np in an error path. That would improve maintainability
imho.

Thanks,
Antoine

>         priv->regmap = syscon_node_to_regmap(parent_np);
>         of_node_put(parent_np);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ