All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Subhransu S. Prusty" <subhransu.s.prusty@intel.com>
To: Fabio Estevam <festevam@gmail.com>
Cc: Fabio Estevam <fabio.estevam@nxp.com>,
	jeeja.kp@intel.com, alsa-devel@alsa-project.org,
	broonie@kernel.org, dan.carpenter@oracle.com
Subject: Re: [PATCH] ASoC: hdac_hdmi: Dereference 'edev' after checking for NULL
Date: Wed, 17 Feb 2016 14:51:52 +0530	[thread overview]
Message-ID: <20160217092147.GA3769@subhransu-desktop> (raw)
In-Reply-To: <1455700199-18691-1-git-send-email-festevam@gmail.com>

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
> 

-- 

  reply	other threads:[~2016-02-17  9:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2016-02-17 19:20 ` Mark Brown
2016-02-17 19:52   ` Fabio Estevam

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=20160217092147.GA3769@subhransu-desktop \
    --to=subhransu.s.prusty@intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=dan.carpenter@oracle.com \
    --cc=fabio.estevam@nxp.com \
    --cc=festevam@gmail.com \
    --cc=jeeja.kp@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.