public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Daniil Tatianin <d-tatianin@yandex-team.ru>
Cc: Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
	Tim Crawford <tcrawford@system76.com>,
	Stefan Binding <sbinding@opensource.cirrus.com>,
	Kai-Heng Feng <kai.heng.feng@canonical.com>,
	Meng Tang <tangmeng@uniontech.com>,
	Lucas Tanure <tanureal@opensource.cirrus.com>,
	Philipp Jungkamp <p.jungkamp@gmx.net>,
	Werner Sembach <wse@tuxedocomputers.com>,
	alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org,
	lvc-project@linuxtesting.org, yc-core@yandex-team.ru
Subject: Re: [PATCH v1] sound/pci/hda/patch_realtek: don't call alc_shutup_pins without a spec
Date: Mon, 14 Nov 2022 09:26:24 +0100	[thread overview]
Message-ID: <87r0y63psf.wl-tiwai@suse.de> (raw)
In-Reply-To: <20221114082048.3477027-1-d-tatianin@yandex-team.ru>

On Mon, 14 Nov 2022 09:20:48 +0100,
Daniil Tatianin wrote:
> 
> alc_shutup_pins always expects the spec to be present, so make sure
> it is before we call it.
> 
> Found by Linux Verification Center (linuxtesting.org) with the SVACE
> static analysis tool.
> 
> Signed-off-by: Daniil Tatianin <d-tatianin@yandex-team.ru>

In which path can it be without spec assigned?
That's the internal callback that is set only by the codec driver
where the allocation of codec->spec is mandatory.


thanks,

Takashi


> ---
>  sound/pci/hda/patch_realtek.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
> index 60e3bc124836..2cf4b64971d7 100644
> --- a/sound/pci/hda/patch_realtek.c
> +++ b/sound/pci/hda/patch_realtek.c
> @@ -939,10 +939,12 @@ static inline void alc_shutup(struct hda_codec *codec)
>  {
>  	struct alc_spec *spec = codec->spec;
>  
> +	if (!spec)
> +		return;
>  	if (!snd_hda_get_bool_hint(codec, "shutup"))
>  		return; /* disabled explicitly by hints */
>  
> -	if (spec && spec->shutup)
> +	if (spec->shutup)
>  		spec->shutup(codec);
>  	else
>  		alc_shutup_pins(codec);
> -- 
> 2.25.1
> 

       reply	other threads:[~2022-11-14  8:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20221114082048.3477027-1-d-tatianin@yandex-team.ru>
2022-11-14  8:26 ` Takashi Iwai [this message]
     [not found]   ` <d3a31735-8f5c-3168-6a0d-2cf1e9005864@yandex-team.ru>
2022-11-14  8:54     ` [PATCH v1] sound/pci/hda/patch_realtek: don't call alc_shutup_pins without a spec Takashi Iwai

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=87r0y63psf.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=d-tatianin@yandex-team.ru \
    --cc=kai.heng.feng@canonical.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lvc-project@linuxtesting.org \
    --cc=p.jungkamp@gmx.net \
    --cc=perex@perex.cz \
    --cc=sbinding@opensource.cirrus.com \
    --cc=tangmeng@uniontech.com \
    --cc=tanureal@opensource.cirrus.com \
    --cc=tcrawford@system76.com \
    --cc=tiwai@suse.com \
    --cc=wse@tuxedocomputers.com \
    --cc=yc-core@yandex-team.ru \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox