Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1531592pxk; Tue, 1 Sep 2020 00:35:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz4+ES5Gk79niFyOptHu/qo0wPreO251y5dKrQkkyE0ZmPieuRUmT6cwvdTw3KmgaEYl0vG X-Received: by 2002:a17:906:3993:: with SMTP id h19mr353189eje.111.1598945748280; Tue, 01 Sep 2020 00:35:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598945748; cv=none; d=google.com; s=arc-20160816; b=eoIDMYUg4zYVnbS632+hIqK9KLfz1c/RolLw0pGMC+5Q151o1HE6AH7zOUmAaIT2O+ j3YHT4A9nSxWaoax62RdDyhO/1ntS6OIRfRqrHzGdMr9vxiF/es7PTY4jz6uofrG5Mcf 0XJUKZYq7aOMxyT1OKsVbvMJFOWEdA834+WmtvthNhY+OUjNZwp/WnlalkbUVg6d9/h5 sJFQ6t1f4j5Wqagw2qB9mOkkZv7F5gjL6r+2C1WmtiyxgNoAHIK3AwOCTFU+viin7C8v El2/Y3bcV4oFFxWwqJM0IQbi7UJ3JQQVU3ZC6EFFnwuJGi2iIgCpPjRq7+OCZJYAq1xl FNFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:ironport-sdr:dkim-signature; bh=ShxaEFx48sdlmYl8Cn29yMPtphJjPlK3B3A8bgDbuVQ=; b=Ca9OeesVUTsKDY0jUtQvzicbueUyb4kz3myyKSmPoFtCTYRhzX4O02ozvSKPzb1zEs Jp5CWvZ7JFIV/cXPDmbhgTjvBxdYdb1uNehvOKJwtGBJM03vDBEEBu93tIxMulD3cEFE iz+/RxnJsmyPayf8y3cOMbH4zVS40v+ri29i7SibJF9agr6W3OIQrrmlIc4fRcUtS0ME 9hfzoB17f2TIrNpOw4oo5XOOF/SSipUYu4AzMDMbwCEQqUiZDdFxOkBpRd+Sx97ikyIo sj1oePqv0g1vg2c2OIljfShbmsL3bjb3U+vKA64JzH3jf8OVRuZ9y7B3m2lTedOZU2uT MoCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@axis.com header.s=axis-central1 header.b=SD848XAE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=axis.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id yw17si242110ejb.394.2020.09.01.00.35.25; Tue, 01 Sep 2020 00:35:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@axis.com header.s=axis-central1 header.b=SD848XAE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=axis.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726310AbgIAHec (ORCPT + 99 others); Tue, 1 Sep 2020 03:34:32 -0400 Received: from smtp2.axis.com ([195.60.68.18]:33014 "EHLO smtp2.axis.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726224AbgIAHec (ORCPT ); Tue, 1 Sep 2020 03:34:32 -0400 X-Greylist: delayed 428 seconds by postgrey-1.27 at vger.kernel.org; Tue, 01 Sep 2020 03:34:31 EDT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axis.com; l=995; q=dns/txt; s=axis-central1; t=1598945671; x=1630481671; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=ShxaEFx48sdlmYl8Cn29yMPtphJjPlK3B3A8bgDbuVQ=; b=SD848XAEIwsawHwHgmSaK2V3yHxC7f9vUZn5nqbMQfNED8DIXEU+xwje ckE9MhOWa/7xs7jdH/czBgrDLnksZwCE+MQRfVWNeCANMb/DRKIcMWHco tbZUyHmQLGXRG+oQu7gjID0PKS5LcEClkE7m8GlaiLC5HpIGig3jV7iOP NQgXnIfEoWZlxhngFIMH+f/5Vfy5Op5mUM7jk4fDVYwWBDFYzr5DMQCQr 8t3XtiYU2HYQSZTMVHC8Web0dpt17Go/bpDvlroecdqAQJf+bOtE8mqZC /XfmypUX8SydYmdntIVOch2CbjtAxuA+NcUa4c5afqCqQDexVgSqcHh+0 w==; IronPort-SDR: 6wvZqcrh8ZvNMxqhgd4/XGbB+UlSLzwDBAWg/RS3zxVpQu80m5TPFiDIX2iMUBowe98gnwm//z 8VJnQFFVcQZgKFAlO0NK3/issBqDOp0IpfG7EMJdVaKWuW7qCpsO/T/3+Cyv7wcZ+pX6a1O4f7 P6CIfANY+XDAcnHaHxzBTfTOo/w+hqD0FgaGvjEbsanfOI9mH1KMTXpf3XgoC2vKf9ugoEx5EG 9zepESA3jj9btI5RD2ktpSnvPEB9ddQ09a40wwGEL9ADjXChE7nX6iv29iCGO1keMGecn1cC7R xJE= X-IronPort-AV: E=Sophos;i="5.76,378,1592863200"; d="scan'208";a="12070617" From: Camel Guo To: , , , , CC: , , , Camel Guo , Camel Guo Subject: [PATCH] ASoC: tlv320adcx140: Fix accessing uninitialized abcx140->dev Date: Tue, 1 Sep 2020 09:27:10 +0200 Message-ID: <20200901072710.2031-1-camel.guo@axis.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Camel Guo in adcx140_i2c_probe, adcx140->dev is accessed before its initialization. This commit fixes this bug. Signed-off-by: Camel Guo --- sound/soc/codecs/tlv320adcx140.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sound/soc/codecs/tlv320adcx140.c b/sound/soc/codecs/tlv320adcx140.c index 5cd50d841177..7ae6ec374be3 100644 --- a/sound/soc/codecs/tlv320adcx140.c +++ b/sound/soc/codecs/tlv320adcx140.c @@ -980,6 +980,8 @@ static int adcx140_i2c_probe(struct i2c_client *i2c, if (!adcx140) return -ENOMEM; + adcx140->dev = &i2c->dev; + adcx140->gpio_reset = devm_gpiod_get_optional(adcx140->dev, "reset", GPIOD_OUT_LOW); if (IS_ERR(adcx140->gpio_reset)) @@ -1007,7 +1009,7 @@ static int adcx140_i2c_probe(struct i2c_client *i2c, ret); return ret; } - adcx140->dev = &i2c->dev; + i2c_set_clientdata(i2c, adcx140); return devm_snd_soc_register_component(&i2c->dev, -- 2.20.1