All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH][V2][next] ASoC: rk817: remove redundant assignment to pointer node, add missing of_node_put
@ 2021-06-03 11:36 Colin King
  2021-06-04 16:01 ` Chris Morgan
  2021-06-07 19:00   ` Mark Brown
  0 siblings, 2 replies; 4+ messages in thread
From: Colin King @ 2021-06-03 11:36 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	Chris Morgan, Lee Jones, alsa-devel
  Cc: kernel-janitors, linux-kernel

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>
---
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);
 }
 
 static int rk817_platform_probe(struct platform_device *pdev)
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH][V2][next] ASoC: rk817: remove redundant assignment to pointer node, add missing of_node_put
  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
  2021-06-07 19:00   ` Mark Brown
  1 sibling, 0 replies; 4+ messages in thread
From: Chris Morgan @ 2021-06-04 16:01 UTC (permalink / raw)
  To: Colin King
  Cc: alsa-devel, linux-kernel, kernel-janitors, Takashi Iwai,
	Liam Girdwood, Mark Brown, Lee Jones

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
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH][V2][next] ASoC: rk817: remove redundant assignment to pointer node, add missing of_node_put
  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-07 19:00   ` Mark Brown
  2021-06-07 19:00   ` Mark Brown
  1 sibling, 0 replies; 4+ messages in thread
From: Mark Brown @ 2021-06-07 19:00 UTC (permalink / raw)
  To: Takashi Iwai, alsa-devel, Colin King, Lee Jones, Jaroslav Kysela,
	Liam Girdwood, Chris Morgan
  Cc: Mark Brown, linux-kernel, kernel-janitors

On Thu, 3 Jun 2021 12:36:59 +0100, Colin King wrote:
> 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.

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] ASoC: rk817: remove redundant assignment to pointer node, add missing of_node_put
      commit: d50b86b3f6abc4ff8a35f706a6b8251a2d4cf58f

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH][V2][next] ASoC: rk817: remove redundant assignment to pointer node, add missing of_node_put
@ 2021-06-07 19:00   ` Mark Brown
  0 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2021-06-07 19:00 UTC (permalink / raw)
  To: Takashi Iwai, alsa-devel, Colin King, Lee Jones, Jaroslav Kysela,
	Liam Girdwood, Chris Morgan
  Cc: Mark Brown, kernel-janitors, linux-kernel

On Thu, 3 Jun 2021 12:36:59 +0100, Colin King wrote:
> 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.

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] ASoC: rk817: remove redundant assignment to pointer node, add missing of_node_put
      commit: d50b86b3f6abc4ff8a35f706a6b8251a2d4cf58f

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-06-07 19:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2021-06-07 19:00 ` Mark Brown
2021-06-07 19:00   ` Mark Brown

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.