* [PATCH] ASoC: hdac_hdmi: Dereference 'edev' after checking for NULL
@ 2016-02-17 9:09 Fabio Estevam
2016-02-17 9:21 ` Subhransu S. Prusty
2016-02-17 19:20 ` Mark Brown
0 siblings, 2 replies; 4+ messages in thread
From: Fabio Estevam @ 2016-02-17 9:09 UTC (permalink / raw)
To: broonie
Cc: Fabio Estevam, jeeja.kp, alsa-devel, subhransu.s.prusty,
dan.carpenter
From: Fabio Estevam <fabio.estevam@nxp.com>
Commit 4a3478debf36 ("ASoC: hdac_hdmi: Add jack reporting")
leads to the following Smatch complaint:
sound/soc/codecs/hdac_hdmi.c:971 hdac_hdmi_present_sense()
warn: variable dereferenced before check 'edev' (see line 967)
,so deference 'edev' after checking for NULL.
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
---
sound/soc/codecs/hdac_hdmi.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/sound/soc/codecs/hdac_hdmi.c b/sound/soc/codecs/hdac_hdmi.c
index 36f1200..920af2f 100644
--- a/sound/soc/codecs/hdac_hdmi.c
+++ b/sound/soc/codecs/hdac_hdmi.c
@@ -964,13 +964,15 @@ static int hdac_hdmi_add_cvt(struct hdac_ext_device *edev, hda_nid_t nid)
static void hdac_hdmi_present_sense(struct hdac_hdmi_pin *pin, int repoll)
{
struct hdac_ext_device *edev = pin->edev;
- struct hdac_hdmi_priv *hdmi = edev->private_data;
+ struct hdac_hdmi_priv *hdmi;
struct hdac_hdmi_pcm *pcm;
int val;
if (!edev)
return;
+ hdmi = edev->private_data;
+
pin->repoll_count = repoll;
pm_runtime_get_sync(&edev->hdac.dev);
--
1.9.1
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] ASoC: hdac_hdmi: Dereference 'edev' after checking for NULL
2016-02-17 9:09 [PATCH] ASoC: hdac_hdmi: Dereference 'edev' after checking for NULL Fabio Estevam
@ 2016-02-17 9:21 ` Subhransu S. Prusty
2016-02-17 19:20 ` Mark Brown
1 sibling, 0 replies; 4+ messages in thread
From: Subhransu S. Prusty @ 2016-02-17 9:21 UTC (permalink / raw)
To: Fabio Estevam; +Cc: Fabio Estevam, jeeja.kp, alsa-devel, broonie, dan.carpenter
On Wed, Feb 17, 2016 at 07:09:59AM -0200, Fabio Estevam wrote:
> From: Fabio Estevam <fabio.estevam@nxp.com>
>
> Commit 4a3478debf36 ("ASoC: hdac_hdmi: Add jack reporting")
> leads to the following Smatch complaint:
>
> sound/soc/codecs/hdac_hdmi.c:971 hdac_hdmi_present_sense()
> warn: variable dereferenced before check 'edev' (see line 967)
>
> ,so deference 'edev' after checking for NULL.
This NULL check is not required, can be removed.
edev object is expected to be present when the present_sense is called. This
is called from places where this edev object is already available.
Regards,
Subhransu
>
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
> ---
> sound/soc/codecs/hdac_hdmi.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/sound/soc/codecs/hdac_hdmi.c b/sound/soc/codecs/hdac_hdmi.c
> index 36f1200..920af2f 100644
> --- a/sound/soc/codecs/hdac_hdmi.c
> +++ b/sound/soc/codecs/hdac_hdmi.c
> @@ -964,13 +964,15 @@ static int hdac_hdmi_add_cvt(struct hdac_ext_device *edev, hda_nid_t nid)
> static void hdac_hdmi_present_sense(struct hdac_hdmi_pin *pin, int repoll)
> {
> struct hdac_ext_device *edev = pin->edev;
> - struct hdac_hdmi_priv *hdmi = edev->private_data;
> + struct hdac_hdmi_priv *hdmi;
> struct hdac_hdmi_pcm *pcm;
> int val;
>
> if (!edev)
> return;
>
> + hdmi = edev->private_data;
> +
> pin->repoll_count = repoll;
>
> pm_runtime_get_sync(&edev->hdac.dev);
> --
> 1.9.1
>
--
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] ASoC: hdac_hdmi: Dereference 'edev' after checking for NULL
2016-02-17 9:09 [PATCH] ASoC: hdac_hdmi: Dereference 'edev' after checking for NULL Fabio Estevam
2016-02-17 9:21 ` Subhransu S. Prusty
@ 2016-02-17 19:20 ` Mark Brown
2016-02-17 19:52 ` Fabio Estevam
1 sibling, 1 reply; 4+ messages in thread
From: Mark Brown @ 2016-02-17 19:20 UTC (permalink / raw)
To: Fabio Estevam
Cc: Fabio Estevam, jeeja.kp, alsa-devel, subhransu.s.prusty,
dan.carpenter
[-- Attachment #1.1: Type: text/plain, Size: 292 bytes --]
On Wed, Feb 17, 2016 at 07:09:59AM -0200, Fabio Estevam wrote:
> From: Fabio Estevam <fabio.estevam@nxp.com>
>
> Commit 4a3478debf36 ("ASoC: hdac_hdmi: Add jack reporting")
> leads to the following Smatch complaint:
This doesn't apply against current code, please check and resend.
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] ASoC: hdac_hdmi: Dereference 'edev' after checking for NULL
2016-02-17 19:20 ` Mark Brown
@ 2016-02-17 19:52 ` Fabio Estevam
0 siblings, 0 replies; 4+ messages in thread
From: Fabio Estevam @ 2016-02-17 19:52 UTC (permalink / raw)
To: Mark Brown
Cc: Fabio Estevam, jeeja.kp, alsa-devel@alsa-project.org,
subhransu.s.prusty, Dan Carpenter
Hi Mark,
On Wed, Feb 17, 2016 at 5:20 PM, Mark Brown <broonie@kernel.org> wrote:
> On Wed, Feb 17, 2016 at 07:09:59AM -0200, Fabio Estevam wrote:
>> From: Fabio Estevam <fabio.estevam@nxp.com>
>>
>> Commit 4a3478debf36 ("ASoC: hdac_hdmi: Add jack reporting")
>> leads to the following Smatch complaint:
>
> This doesn't apply against current code, please check and resend.
It seems you have already applied it;
https://git.kernel.org/cgit/linux/kernel/git/broonie/sound.git/commit/?h=for-next&id=cd890ade492784ae06dadd20e688ba1760d3c801
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-02-17 19:52 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-17 9:09 [PATCH] ASoC: hdac_hdmi: Dereference 'edev' after checking for NULL Fabio Estevam
2016-02-17 9:21 ` Subhransu S. Prusty
2016-02-17 19:20 ` Mark Brown
2016-02-17 19:52 ` Fabio Estevam
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).