All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Liam Girdwood <lgirdwood@gmail.com>, Jeeja KP <jeeja.kp@intel.com>
Cc: alsa-devel@alsa-project.org,
	Dharageswari R <dharageswari.r@intel.com>,
	Lukas Wunner <lukas@wunner.de>, Vinod Koul <vinod.koul@intel.com>,
	Pardha Saradhi K <pardha.saradhi.kesapragada@intel.com>,
	Jayachandran B <jayachandran.b@intel.com>,
	kernel-janitors@vger.kernel.org, Takashi Iwai <tiwai@suse.com>,
	Mark Brown <broonie@kernel.org>,
	"Subhransu S. Prusty" <subhransu.s.prusty@intel.com>,
	Yong Zhi <yong.zhi@intel.com>
Subject: [PATCH] ASoC: Intel: Skylake: Uninitialized variable in probe_codec()
Date: Thu, 20 Apr 2017 10:17:02 +0000	[thread overview]
Message-ID: <20170420101702.nlq3537xumrseu26@mwanda> (raw)

My static checker complains that if snd_hdac_bus_get_response() returns
-EIO then "res" is uninitialized.  Fix this by initializing it to -1 so
that the error is handled correctly.

Fixes: d8c2dab8381d ("ASoC: Intel: Add Skylake HDA audio driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/sound/soc/intel/skylake/skl.c b/sound/soc/intel/skylake/skl.c
index 0c57d4eaae3a..6df3b317a476 100644
--- a/sound/soc/intel/skylake/skl.c
+++ b/sound/soc/intel/skylake/skl.c
@@ -512,7 +512,7 @@ static int probe_codec(struct hdac_ext_bus *ebus, int addr)
 	struct hdac_bus *bus = ebus_to_hbus(ebus);
 	unsigned int cmd = (addr << 28) | (AC_NODE_ROOT << 20) |
 		(AC_VERB_PARAMETERS << 8) | AC_PAR_VENDOR_ID;
-	unsigned int res;
+	unsigned int res = -1;
 
 	mutex_lock(&bus->cmd_mutex);
 	snd_hdac_bus_send_cmd(bus, cmd);

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Liam Girdwood <lgirdwood@gmail.com>, Jeeja KP <jeeja.kp@intel.com>
Cc: alsa-devel@alsa-project.org,
	Dharageswari R <dharageswari.r@intel.com>,
	Lukas Wunner <lukas@wunner.de>, Vinod Koul <vinod.koul@intel.com>,
	Pardha Saradhi K <pardha.saradhi.kesapragada@intel.com>,
	Jayachandran B <jayachandran.b@intel.com>,
	kernel-janitors@vger.kernel.org, Takashi Iwai <tiwai@suse.com>,
	Mark Brown <broonie@kernel.org>,
	"Subhransu S. Prusty" <subhransu.s.prusty@intel.com>,
	Yong Zhi <yong.zhi@intel.com>
Subject: [PATCH] ASoC: Intel: Skylake: Uninitialized variable in probe_codec()
Date: Thu, 20 Apr 2017 13:17:02 +0300	[thread overview]
Message-ID: <20170420101702.nlq3537xumrseu26@mwanda> (raw)

My static checker complains that if snd_hdac_bus_get_response() returns
-EIO then "res" is uninitialized.  Fix this by initializing it to -1 so
that the error is handled correctly.

Fixes: d8c2dab8381d ("ASoC: Intel: Add Skylake HDA audio driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/sound/soc/intel/skylake/skl.c b/sound/soc/intel/skylake/skl.c
index 0c57d4eaae3a..6df3b317a476 100644
--- a/sound/soc/intel/skylake/skl.c
+++ b/sound/soc/intel/skylake/skl.c
@@ -512,7 +512,7 @@ static int probe_codec(struct hdac_ext_bus *ebus, int addr)
 	struct hdac_bus *bus = ebus_to_hbus(ebus);
 	unsigned int cmd = (addr << 28) | (AC_NODE_ROOT << 20) |
 		(AC_VERB_PARAMETERS << 8) | AC_PAR_VENDOR_ID;
-	unsigned int res;
+	unsigned int res = -1;
 
 	mutex_lock(&bus->cmd_mutex);
 	snd_hdac_bus_send_cmd(bus, cmd);

             reply	other threads:[~2017-04-20 10:17 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-20 10:17 Dan Carpenter [this message]
2017-04-20 10:17 ` [PATCH] ASoC: Intel: Skylake: Uninitialized variable in probe_codec() Dan Carpenter
2017-04-21 17:28 ` Applied "ASoC: Intel: Skylake: Uninitialized variable in probe_codec()" to the asoc tree Mark Brown
2017-04-21 17:28   ` Mark Brown
2017-04-27 18:50 ` [PATCH] ASoC: Intel: Skylake: uninitialized variable in error message Dan Carpenter
2017-04-27 18:50   ` Dan Carpenter
2017-04-27 22:36   ` Takashi Sakamoto
2017-04-27 22:36     ` Takashi Sakamoto

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=20170420101702.nlq3537xumrseu26@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=dharageswari.r@intel.com \
    --cc=jayachandran.b@intel.com \
    --cc=jeeja.kp@intel.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=lukas@wunner.de \
    --cc=pardha.saradhi.kesapragada@intel.com \
    --cc=subhransu.s.prusty@intel.com \
    --cc=tiwai@suse.com \
    --cc=vinod.koul@intel.com \
    --cc=yong.zhi@intel.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.