Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3863461imu; Mon, 7 Jan 2019 10:51:35 -0800 (PST) X-Google-Smtp-Source: ALg8bN6ye4oeKwECarNl8pQ+5AE5ntQWKarea5hP7U3zln1rMH1Nw4UqK3a/eDJD8agWObQQroAg X-Received: by 2002:a17:902:20c8:: with SMTP id v8mr63181744plg.319.1546887095886; Mon, 07 Jan 2019 10:51:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546887095; cv=none; d=google.com; s=arc-20160816; b=OJ9j4A+DrKYN1Zq3IvaVAGVhFU4s+LPHuhs/zHYEGQSswH7kHOuZjeh+dbtLJ6V1vx rKSRrdCl+pgUybUNqmIiLVzRjjTsNoxpiyR/A1yghfP6b3BAUz8Sd59hZdcedGjQxdPB xhJ5N0PjiKe9xeEifLclJl/2mg223DMsHsUkayeTeLugL0RWoocPRUFJ7b2qlX8F4BaO bYunyXRU5KKJ8EmlPWYfWQ9pkZXJgEEDSycsfKA6RIIXzMVxoX9KijGYcGIt/z/bp16R /l9GhfEbuqS1cOLghqqp43/ppbuQwioq2T5eonIkdstCNfNueGucW6c1xW5CWVwvd8P1 +Kpg== 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:dkim-signature; bh=QFbkdOcc4Vakj8FaonWmGa7XLFzcp4C7IaWwXYRdoOM=; b=HTXxH9lISMZQx9OOhk6fIl/N/pJ2myW1Piaiy3ySc/HyTl87YxHN6yLFtev804juQq /GyeA/TV4kvjiDazqhJPA1fukiLZ0H4bzzrXPWH6IJZxNEMzTQkgPHnlx8xGufX3AMYb MOTHOOwH8MzIWXYIFXbzNX1D09mwRPY+5d+NC+24iRxhYhC33goKlm0zFdCBtnVzbJPL RrlN4NLilWRSAFd17N52U4ktb3CImwnIrt9U9eTW7A8tXR5gS2WmFTH4XXWRgPKgPh9I l8VRvkpIuyyKTuZCkWWKQi6XYf9WXDVitsE8Ca5AsdDUHDwZq08UO6QWpMfqXy6njCbF zgRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=o4eQ5JZ7; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q32si62252723pgm.410.2019.01.07.10.51.20; Mon, 07 Jan 2019 10:51:35 -0800 (PST) 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; dkim=fail header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=o4eQ5JZ7; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730689AbfAGQ3J (ORCPT + 99 others); Mon, 7 Jan 2019 11:29:09 -0500 Received: from heliosphere.sirena.org.uk ([172.104.155.198]:44460 "EHLO heliosphere.sirena.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729314AbfAGQ3J (ORCPT ); Mon, 7 Jan 2019 11:29:09 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sirena.org.uk; s=20170815-heliosphere; h=In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=QFbkdOcc4Vakj8FaonWmGa7XLFzcp4C7IaWwXYRdoOM=; b=o4eQ5JZ7p5A58HKbz7yJ3i1L/ H3pZJL2S8otoaWO0JV4KTLaICmYynZKipHp4TK5Ht1rlI7fWft3hDdY0vm0srGJlaUpmIU0AmpIgo bIVM5QLe9vvIdu8SLJsXvjFs6nL79kaHRQy0tQgY+VLnf0JP7baToyhZGhXIBygEvte7I=; Received: from cpc102320-sgyl38-2-0-cust46.18-2.cable.virginm.net ([82.37.168.47] helo=debutante.sirena.org.uk) by heliosphere.sirena.org.uk with esmtpa (Exim 4.89) (envelope-from ) id 1ggXld-0007Sp-92; Mon, 07 Jan 2019 16:28:45 +0000 Received: by debutante.sirena.org.uk (Postfix, from userid 1000) id AD2951127491; Mon, 7 Jan 2019 16:28:44 +0000 (GMT) Date: Mon, 7 Jan 2019 16:28:44 +0000 From: Mark Brown To: Yizhuo Cc: csong@cs.ucr.edu, zhiyunq@cs.ucr.edu, Bard Liao , Oder Chiou , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] ASoC: rt298: Variable "val" and "buf" in rt298_jack_detect() could be uninitialized Message-ID: <20190107162844.GK9570@sirena.org.uk> References: <20190104215253.16278-1-yzhai003@ucr.edu> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="IJAclU0AInkryoed" Content-Disposition: inline In-Reply-To: <20190104215253.16278-1-yzhai003@ucr.edu> X-Cookie: NOBODY EXPECTS THE SPANISH INQUISITION! User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --IJAclU0AInkryoed Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Fri, Jan 04, 2019 at 01:52:53PM -0800, Yizhuo wrote: > { > struct snd_soc_dapm_context *dapm; > unsigned int val, buf; > + int ret = 0; It's bad practice to just initailize like this without a reason - it tends to just mask actual cases where we miss error handling by ensuring that it's always initialized. > if (0x0070 == (val & 0x0070)) { > *mic = true; > } else { > regmap_update_bits(rt298->regmap, > RT298_CBJ_CTRL1, 0xfcc0, 0xe400); > msleep(300); > - regmap_read(rt298->regmap, > + ret = regmap_read(rt298->regmap, > RT298_CBJ_CTRL2, &val); > + if (ret) > + return ret; We've started doing some writes to the device (which you've not added checks for) here but then if the read fails we just bomb out with an error code - are you sure that none of the writes need to be reverted? --IJAclU0AInkryoed Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAlwzfjsACgkQJNaLcl1U h9B8ZAf/crhqUm6mmOd0Zu21moCGdovWEr4Dks4ovW6tH+i8R8DPPlFwFrrwqoUC AmfutDFZo0Ee87LDb6olzsVWECeXWeQpuv4DyKz+nmpnjUSqbZ0Vqgc0abSTHY8b 9PY/xrggQsOYc4vsW+/1NpmkZ/ATsaQ8zzNJyX0H4Ywt/BPTSoT7R8PGGxo//gC1 1LN7TgNgWxa/tHknt8d6tvDCfW1miFApieGEmPyZSpDoUY1qfceMvdkD+2gX80wF P+ZwDvKykq6kGNH2/nVYPc8pErH/ADtMmHR3fpOlKEcG3Rv7I3iiboPmevqyJVZl Ml8x0GeaTZMAsvhfdKEFRKFTo+5JRg== =tyXZ -----END PGP SIGNATURE----- --IJAclU0AInkryoed--