All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Morgan <macromorgan@hotmail.com>
To: Colin King <colin.king@canonical.com>
Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org,
	kernel-janitors@vger.kernel.org, Takashi Iwai <tiwai@suse.com>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>, Lee Jones <lee.jones@linaro.org>
Subject: Re: [PATCH][V2][next] ASoC: rk817: remove redundant assignment to pointer node, add missing of_node_put
Date: Fri, 4 Jun 2021 11:01:40 -0500	[thread overview]
Message-ID: <SN6PR06MB5342B6B6B21665F2E43CAAA7A53B9@SN6PR06MB5342.namprd06.prod.outlook.com> (raw)
In-Reply-To: <20210603113659.82031-1-colin.king@canonical.com>

On Thu, Jun 03, 2021 at 12:36:59PM +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> The pointer node is being initialized with a value that is never read and
> it is being updated later with a new value.  The initialization is
> redundant and can be removed.
> 
> The function is missing a of_node_put on node, fix this by adding the call
> before returning.
> 
> Addresses-Coverity: ("Unused value")
> Fixes: 0d6a04da9b25 ("ASoC: Add Rockchip rk817 audio CODEC support")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Tested-by: Chris Morgan <macromorgan@hotmail.com>

> ---
> V2: Add missing of_node_put call, kudos to Dan Carpenter for spotting this 
>     issue.
> ---
>  sound/soc/codecs/rk817_codec.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/sound/soc/codecs/rk817_codec.c b/sound/soc/codecs/rk817_codec.c
> index fd3a5ba034a9..a44d3cad1119 100644
> --- a/sound/soc/codecs/rk817_codec.c
> +++ b/sound/soc/codecs/rk817_codec.c
> @@ -456,7 +456,7 @@ static const struct snd_soc_component_driver soc_codec_dev_rk817 = {
>  static void rk817_codec_parse_dt_property(struct device *dev,
>  					 struct rk817_codec_priv *rk817)
>  {
> -	struct device_node *node = dev->parent->of_node;
> +	struct device_node *node;
>  
>  	node = of_get_child_by_name(dev->parent->of_node, "codec");
>  	if (!node) {
> @@ -466,6 +466,8 @@ static void rk817_codec_parse_dt_property(struct device *dev,
>  
>  	rk817->mic_in_differential =
>  			of_property_read_bool(node, "rockchip,mic-in-differential");
> +
> +	of_node_put(node);
>  }

Tested these changes and they appear to work just fine. Thank you.

>  
>  static int rk817_platform_probe(struct platform_device *pdev)
> -- 
> 2.31.1
> 

  reply	other threads:[~2021-06-04 16:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-03 11:36 [PATCH][V2][next] ASoC: rk817: remove redundant assignment to pointer node, add missing of_node_put Colin King
2021-06-04 16:01 ` Chris Morgan [this message]
2021-06-07 19:00 ` Mark Brown
2021-06-07 19:00   ` 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=SN6PR06MB5342B6B6B21665F2E43CAAA7A53B9@SN6PR06MB5342.namprd06.prod.outlook.com \
    --to=macromorgan@hotmail.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=colin.king@canonical.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=lee.jones@linaro.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tiwai@suse.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.