linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Markus Elfring <Markus.Elfring@web.de>
To: Nishka Dasgupta <nishkadg.linux@gmail.com>,
	Mark Brown <broonie@kernel.org>,
	Liam Girdwood <lgirdwood@gmail.com>
Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] regulator: core: Add of_node_put() before return
Date: Mon, 5 Aug 2019 14:30:55 +0200	[thread overview]
Message-ID: <127231a4-f181-e172-2262-eb2604cacb0b@web.de> (raw)
In-Reply-To: <20190804162023.5673-1-nishkadg.linux@gmail.com>

> +++ b/drivers/regulator/core.c
> @@ -380,9 +380,12 @@ static struct device_node *of_get_child_regulator(struct device_node *parent,
>
>  		if (!regnode) {
>  			regnode = of_get_child_regulator(child, prop_name);
> -			if (regnode)
> +			if (regnode) {
> +				of_node_put(child);
>  				return regnode;
> +			}
>  		} else {
> +			of_node_put(child);
>  			return regnode;
>  		}
>  	}

I suggest to move common exception handling code to the end of
this function implementation.
Would you like to add a jump target like “put_node”?

Regards,
Markus

  reply	other threads:[~2019-08-05 12:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-04 16:20 [PATCH] regulator: core: Add of_node_put() before return Nishka Dasgupta
2019-08-05 12:30 ` Markus Elfring [this message]
2019-08-05 16:10 ` Applied "regulator: core: Add of_node_put() before return" to the regulator tree Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=127231a4-f181-e172-2262-eb2604cacb0b@web.de \
    --to=markus.elfring@web.de \
    --cc=broonie@kernel.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nishkadg.linux@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).