diff mbox

[2/4] ASoC: eukrea-tlv320: Fix of_node_put() call with uninitialized object

Message ID 1412698794-25536-3-git-send-email-tiwai@suse.de (mailing list archive)
State New, archived
Headers show

Commit Message

Takashi Iwai Oct. 7, 2014, 4:19 p.m. UTC
The of_node_put() call in eukrea_tlv320_probe() may take an
uninitialized pointer, as compiler spotted out:
  sound/soc/codecs/mc13783.c:787:13: warning: 'np' may be used uninitialized in this function [-Wuninitialized]

This patch adds the proper NULL initialization as a fix.

Fixes: 66f232908de2 ('ASoC: eukrea-tlv320: Add DT support')
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/soc/fsl/eukrea-tlv320.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Mark Brown Oct. 7, 2014, 5:18 p.m. UTC | #1
On Tue, Oct 07, 2014 at 06:19:52PM +0200, Takashi Iwai wrote:

> -	struct device_node *ssi_np, *codec_np;
> +	struct device_node *ssi_np = NULL, *codec_np;

As well as the NULL thing mixing initialized and unintialized things in
one declaration is something that's normally avoided.
Takashi Iwai Oct. 7, 2014, 5:39 p.m. UTC | #2
At Tue, 7 Oct 2014 18:18:00 +0100,
Mark Brown wrote:
> 
> On Tue, Oct 07, 2014 at 06:19:52PM +0200, Takashi Iwai wrote:
> 
> > -	struct device_node *ssi_np, *codec_np;
> > +	struct device_node *ssi_np = NULL, *codec_np;
> 
> As well as the NULL thing mixing initialized and unintialized things in
> one declaration is something that's normally avoided.

I thought of that, too.  For simplicity, we can do NULL
initializations for both, of course, if you prefer.


Takashi
diff mbox

Patch

diff --git a/sound/soc/fsl/eukrea-tlv320.c b/sound/soc/fsl/eukrea-tlv320.c
index eb093d5b85c4..d53b002595b6 100644
--- a/sound/soc/fsl/eukrea-tlv320.c
+++ b/sound/soc/fsl/eukrea-tlv320.c
@@ -105,7 +105,7 @@  static int eukrea_tlv320_probe(struct platform_device *pdev)
 	int ret;
 	int int_port = 0, ext_port;
 	struct device_node *np = pdev->dev.of_node;
-	struct device_node *ssi_np, *codec_np;
+	struct device_node *ssi_np = NULL, *codec_np;
 
 	eukrea_tlv320.dev = &pdev->dev;
 	if (np) {