diff mbox series

[next] ASoC: rk817: remove redundant assignment to pointer node

Message ID 20210602102746.11793-1-colin.king@canonical.com (mailing list archive)
State New, archived
Headers show
Series [next] ASoC: rk817: remove redundant assignment to pointer node | expand

Commit Message

Colin King June 2, 2021, 10:27 a.m. UTC
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.

Addresses-Coverity: ("Unused value")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 sound/soc/codecs/rk817_codec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Dan Carpenter June 2, 2021, 11:24 a.m. UTC | #1
On Wed, Jun 02, 2021 at 11:27:46AM +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.
> 
> Addresses-Coverity: ("Unused value")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  sound/soc/codecs/rk817_codec.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/sound/soc/codecs/rk817_codec.c b/sound/soc/codecs/rk817_codec.c
> index 17e672b85ee5..0d7cc26ded57 100644
> --- a/sound/soc/codecs/rk817_codec.c
> +++ b/sound/soc/codecs/rk817_codec.c
> @@ -457,7 +457,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) {

This function needs an of_node_put().

regards,
dan carpenter
Chris Morgan June 2, 2021, 2:11 p.m. UTC | #2
On Wed, Jun 02, 2021 at 02:24:16PM +0300, Dan Carpenter wrote:
> On Wed, Jun 02, 2021 at 11:27:46AM +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.
> > 
> > Addresses-Coverity: ("Unused value")
> > Signed-off-by: Colin Ian King <colin.king@canonical.com>
> > ---
> >  sound/soc/codecs/rk817_codec.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/sound/soc/codecs/rk817_codec.c b/sound/soc/codecs/rk817_codec.c
> > index 17e672b85ee5..0d7cc26ded57 100644
> > --- a/sound/soc/codecs/rk817_codec.c
> > +++ b/sound/soc/codecs/rk817_codec.c
> > @@ -457,7 +457,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) {
> 
> This function needs an of_node_put().

I've tested this with the removal of the redundant pointer
initialization and addition of of_node_put() in the "if (!node)"
section and it looks good. Once you make the requested change I
will provide a tested by tag.

Thank you.

> 
> regards,
> dan carpenter
>
diff mbox series

Patch

diff --git a/sound/soc/codecs/rk817_codec.c b/sound/soc/codecs/rk817_codec.c
index 17e672b85ee5..0d7cc26ded57 100644
--- a/sound/soc/codecs/rk817_codec.c
+++ b/sound/soc/codecs/rk817_codec.c
@@ -457,7 +457,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) {