Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp2208284imd; Fri, 2 Nov 2018 07:42:09 -0700 (PDT) X-Google-Smtp-Source: AJdET5ccdAVQ4AlB+RukmY14Dd2Q4/Ez5NbY8uMf/SULS/VQg9Uw7gUKHmgkNeoRFWDxK0MGCSnv X-Received: by 2002:a62:6bc9:: with SMTP id g192-v6mr11921347pfc.232.1541169729495; Fri, 02 Nov 2018 07:42:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541169729; cv=none; d=google.com; s=arc-20160816; b=fhcYotDNP0hIugS1OoBIfyKHcHMWkgKnSgjyqLyTrcqEuZnN3SDzPgCe3IDkfNH3F6 HPXM9wF/LSeHQpYOB3zbHRqQYVsGEasd+gXL71zgW2mo6kaA4djYxdblVoVwaqS/v0vS XnhMBL5ihuvJtY+8wrUmfG+CTHMH5JOkj5oBhFvTCURcDXnkxcqBXnK/x8pnbLVnnP4+ P++FKbWMi98MgvMqIc/UqIstCYDtCtux6JOp2CELu+bEA6q3GgEEr7wezLcOglkXb3wS qUbCIv4UZlAhyugI9L3wFF6d64VSz992pDDP5HmPZg0FO7gahzOaTnlq9ShnRyBSTIuC pimQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=MMcTURFLCSv9NlXCSckjToSts9JPISrhdgEIR4pDS3c=; b=R1CQyXxeW67nkooKTac1G0JeZMdALvkpOgWMoiNj7wCPENllz4t3RfzA9VBFlcbgl6 7OM1R395GWgk+pDmiKZKwqkUQc91+tX4tEAv0HpPbUk1Ol9JM2sE6AdaBgnmRRzFO/iH syRLyfQTYu8Qh6Kkp2mzmKmblOW6/IuJeHj28mCSJ+Yer6fzMB65RvnUBQWH7H0bQsEt cZ0qZOFKZtCtzWbYcrGL03V0C1CfGSvdMZOiXT2d0Xpxh/G2u3iL5N2PM5t5F9iatDow Xgvx996qUktu2qjDetExzOt40lSx6/5jSH1s7jWumkEFha073dwztnJp9AOs++Kaj47n eVwg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cirrus.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g34-v6si35280034pld.392.2018.11.02.07.41.55; Fri, 02 Nov 2018 07:42:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cirrus.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727984AbeKBXqc (ORCPT + 99 others); Fri, 2 Nov 2018 19:46:32 -0400 Received: from mx0a-001ae601.pphosted.com ([67.231.149.25]:44408 "EHLO mx0b-001ae601.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727751AbeKBXqc (ORCPT ); Fri, 2 Nov 2018 19:46:32 -0400 Received: from pps.filterd (m0077473.ppops.net [127.0.0.1]) by mx0a-001ae601.pphosted.com (8.16.0.23/8.16.0.23) with SMTP id wA2EYTUT021266; Fri, 2 Nov 2018 09:38:19 -0500 Authentication-Results: ppops.net; spf=none smtp.mailfrom=ckeepax@opensource.cirrus.com Received: from mail1.cirrus.com (mail1.cirrus.com [141.131.3.20]) by mx0a-001ae601.pphosted.com with ESMTP id 2ncne2yjn1-1; Fri, 02 Nov 2018 09:38:19 -0500 Received: from EX17.ad.cirrus.com (unknown [172.20.9.81]) by mail1.cirrus.com (Postfix) with ESMTP id 19889611E123; Fri, 2 Nov 2018 09:38:19 -0500 (CDT) Received: from imbe.wolfsonmicro.main (198.61.95.81) by EX17.ad.cirrus.com (172.20.9.81) with Microsoft SMTP Server id 14.3.408.0; Fri, 2 Nov 2018 14:38:18 +0000 Received: from imbe.wolfsonmicro.main (imbe.wolfsonmicro.main [198.61.95.81]) by imbe.wolfsonmicro.main (8.14.4/8.14.4) with ESMTP id wA2EcHV9006678; Fri, 2 Nov 2018 14:38:17 GMT Date: Fri, 2 Nov 2018 14:38:17 +0000 From: Charles Keepax To: Arnd Bergmann CC: Jaroslav Kysela , Takashi Iwai , "Robert Jarzmik" , Liam Girdwood , Mark Brown , Kuninori Morimoto , Fabio Estevam , , , Subject: Re: [PATCH] ASoC: wm97xx: fix uninitialized regmap pointer problem Message-ID: <20181102143817.GP16508@imbe.wolfsonmicro.main> References: <20181102112341.753642-1-arnd@arndb.de> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20181102112341.753642-1-arnd@arndb.de> User-Agent: Mutt/1.5.20 (2009-12-10) X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=2 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=876 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1811020133 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Nov 02, 2018 at 12:23:08PM +0100, Arnd Bergmann wrote: > gcc notices that without either the ac97 bus or the pdata, we never > initialize the regmap pointer, which leads to an uninitialized variable > access: > > sound/soc/codecs/wm9712.c: In function 'wm9712_soc_probe': > sound/soc/codecs/wm9712.c:666:2: error: 'regmap' may be used uninitialized in this function [-Werror=maybe-uninitialized] > > Since that configuration is invalid, it's better to return an error > here. I tried to avoid adding complexity to the conditions, and turned > the #ifdef into a regular if(IS_ENABLED()) check for readability. > This in turn requires moving some header file declarations out of > an #ifdef. > > The same code is used in three drivers, all of which I'm changing > the same way. > > Fixes: 2ed1a8e0ce8d ("ASoC: wm9712: add ac97 new bus support") > Signed-off-by: Arnd Bergmann > --- > static void wm9713_soc_remove(struct snd_soc_component *component) > { > -#ifdef CONFIG_SND_SOC_AC97_BUS > struct wm9713_priv *wm9713 = snd_soc_component_get_drvdata(component); > > - if (!wm9713->mfd_pdata) { > + if (IS_ENABLED(CONFIG_SND_SOC_AC97_BUS)) { Should this one not also have an && !wm9713->mfd_pdata? Thanks, Charles > snd_soc_component_exit_regmap(component); > snd_soc_free_ac97_component(wm9713->ac97); > } > -#endif > } > > static const struct snd_soc_component_driver soc_component_dev_wm9713 = { > -- > 2.18.0