Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp5219120rwb; Mon, 14 Nov 2022 00:46:17 -0800 (PST) X-Google-Smtp-Source: AA0mqf58Qrszz6QKJyrNym/qkgwFUH15A0sNFqesJI+MhwQaUpWpkGAk19l+AZu7lBGneoT49EDe X-Received: by 2002:a17:907:989b:b0:7ae:e592:fce5 with SMTP id ja27-20020a170907989b00b007aee592fce5mr5440452ejc.390.1668415576766; Mon, 14 Nov 2022 00:46:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668415576; cv=none; d=google.com; s=arc-20160816; b=mcdHVKnTauWYdYLFRs/8BlzSZ5hoVvZS2CvmMQk5ZIWtSoYua4xnW7SKmhXWVh/uwe fbTsfGCaZ1MJ1pqPtiDb4goi4sqc/cFnOPEujWFUgh5wNmFnFCcXOhQFh44aYwsNxFzw m/6F7ggEIMakesmPuThdaH32u1SEziQRfJWuw2LzWxOxBfvSsDK6cpyvmuib0Z658Jpb UxAfj4g86YUbQ1IIAdub/iHqCeLzyHF+DsI+ahjk4xyxWk6LbLaz9KErAvy+SNRm02tj C1iSiai7wb3n/j+EFKgf58TLg8gqZ8lKEi9zkB76JCNwo2RRnaDUGdDLpax0PLwgoeaP BDNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:in-reply-to :subject:cc:to:from:message-id:date:dkim-signature:dkim-signature; bh=Z2aocgqFLjmTJVHL3ktQa4BmIRZ6GsVn6ZGLHkljFiQ=; b=LiGVcxPdY0kfFrv8XA2iz/07yEvEcy6IU8ELNLCyuEkI9MXsUw8fWGFMMs/7nonaoU rhfbVKNTOSsC1xj1nGDSVi2pi8EPW4WXtM1MZSGD8qdJl4L/U0B8W/WT4zp3ApiOgyxz CDIvYFuABHkwZ9aZ0EfsBcb1YvoJP/2JGZdLgYyBmJtpGqIF3TJlM0O+ICRecT4RUsQh 0QDaW4oWuTCPtWgyRd5VZFT1U5obE5WNm4jQFVR4AD1J2OhwfJjziYlTnf2hk+9xOWh0 4jkp6kwRUMzVit76O1SM0APzJ8kEuZNMe/5mj3LtDFZ278ZnoB0Ox7hOsngd0xovS8yS RdWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=SzF1dX6F; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=LqczeHUl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i7-20020a1709064fc700b007879808e995si9115834ejw.55.2022.11.14.00.45.55; Mon, 14 Nov 2022 00:46:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=SzF1dX6F; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=LqczeHUl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236289AbiKNI02 (ORCPT + 88 others); Mon, 14 Nov 2022 03:26:28 -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 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 >