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 <[email protected]>
> ---
>  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);

Reply via email to