From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D91D8C433FE for ; Mon, 14 Nov 2022 08:26:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236396AbiKNI03 (ORCPT ); Mon, 14 Nov 2022 03:26:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45000 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236232AbiKNI01 (ORCPT ); Mon, 14 Nov 2022 03:26:27 -0500 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A33F06461 for ; Mon, 14 Nov 2022 00:26:26 -0800 (PST) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 5606E2277D; Mon, 14 Nov 2022 08:26:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1668414385; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Z2aocgqFLjmTJVHL3ktQa4BmIRZ6GsVn6ZGLHkljFiQ=; b=SzF1dX6F3sCU+u8GU0fIU9Yiswaz8EZK6CNJm+yyQyJmtWS5Dg6zIyVaN2MgAVB4vCilAf NuJjyQzqga5Mokc8dKh3ttqnMpAEjBPEEh8gYSwP9Hn3hQAYjji6tO+EXMb4cn5G9mT/GB 9WXu+2IHcRAvdHwDvLqEeov2x9i8OJs= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1668414385; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Z2aocgqFLjmTJVHL3ktQa4BmIRZ6GsVn6ZGLHkljFiQ=; b=LqczeHUlnsysaB++Tj/gkeAR7Ysi4h2D0md0WJ5EncrlfzMIJfCAQlX5RcI/Ark02Ud+gf lGXn79YBGCHBLQBg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 14B5D13A8C; Mon, 14 Nov 2022 08:26:25 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id rZ0zBLH7cWM1IQAAMHmgww (envelope-from ); Mon, 14 Nov 2022 08:26:25 +0000 Date: Mon, 14 Nov 2022 09:26:24 +0100 Message-ID: <87r0y63psf.wl-tiwai@suse.de> From: Takashi Iwai To: Daniil Tatianin Cc: Jaroslav Kysela , Takashi Iwai , Tim Crawford , Stefan Binding , Kai-Heng Feng , Meng Tang , Lucas Tanure , Philipp Jungkamp , Werner Sembach , 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 In-Reply-To: <20221114082048.3477027-1-d-tatianin@yandex-team.ru> References: <20221114082048.3477027-1-d-tatianin@yandex-team.ru> User-Agent: Wanderlust/2.15.9 (Almost Unreal) Emacs/27.2 Mule/6.0 MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 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 >