Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3643178pxb; Mon, 24 Jan 2022 14:14:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJxcIcAyqglm4zVhVbHdexHEOzni7WtbuKgMy97Sm3vLBl/yCzBFGpNlM1MdvbAuaG4d1HiM X-Received: by 2002:a63:b24e:: with SMTP id t14mr13389113pgo.381.1643062481401; Mon, 24 Jan 2022 14:14:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643062481; cv=none; d=google.com; s=arc-20160816; b=sBEBSECeBEtwqeQXdBPObjEoanq6xN0KGNlFFd3/AEbb66pwjQ1P5NMfLH1bCVJLY4 +mPXLwQOXU7A3p5mXcpIPWf8d+WBjOhO0P+hnQ3APCRz/JJImIJa0caDQUK4tMQMSy7g Y5jAB1+BJbxXgiPn2cc2tsQ4QoVqTO0cLBE9foJ5808EFn6ionuhHvKq45QhLAuiiHVl 8zjqDsPqPukHa/VpVzCQSiIt7ZS9qLrg4PkgqxGfJIM+GBOKta83KBRxX6q9KARybfKI V0qZPyoJT3cDY7+GoziIqEKo3SEOJkoACocpROchEBYspvKpyTCOgLGPKTBawzhFQ9Sq yOhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=/q6Vc1EYc3Wa5ulcr9tf7rfl+tkZhnkAYZJURUIBwkA=; b=UfgTQC9m8k7DR7aD6hZfS2SNBsMWs1Js9mbAotPEiBq4L/clnf5V8FXoM83PWcxOE6 QvUQnoOPEcMSQKM4e3qSLTlFG5Tyw8JQ17lFQh2Li0LjGg/GcMOXBfh5V1Hi3YwB/h3H 07oP2rBteuTAhFK/2OdG8i83dRBJj/tzhtDpgKXcYlIqeGFOAWyt3Qqqwa4mD9B66W8a C7GmlH3GRs4PCAbP5dCg6TZ8I2UjQvn2pI9htTp0LGYlb1+ScO+wX0aKggAsMbg62Htj kfqSMDhOusPbxQwdB1APggDQweI9Xv8/+urqISJRYR/2oAWM8jUvHNghIP4cG3ef6yOf BdNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=aFYXdpyd; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n22si14708368pfu.0.2022.01.24.14.14.23; Mon, 24 Jan 2022 14:14:41 -0800 (PST) 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 header.i=@linuxfoundation.org header.s=korg header.b=aFYXdpyd; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1579161AbiAXWFE (ORCPT + 99 others); Mon, 24 Jan 2022 17:05:04 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:40852 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378406AbiAXVRZ (ORCPT ); Mon, 24 Jan 2022 16:17:25 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A3FFE60C60; Mon, 24 Jan 2022 21:17:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 88417C340E7; Mon, 24 Jan 2022 21:17:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059042; bh=KELrlWHcvTQuXSNFFxUFF1tW/4V0P2KYuGkbnaXmsdg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aFYXdpydSY/eMO53hRtULDDnhWxoTyBPgLEuZPFDqGzS0aNl00FLLBMddrrF57bcb Yj+tNzhDxa43D63CGnrLs5HGO6dbi74whOa3hWBIs3o+jfGMgc7Ktf/11sAa1e3/Db X4ttRuA8yMXz6CTw1SBraA/tKDD0SQ2oYAriYKEI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jiasheng Jiang , Mark Brown , Sasha Levin Subject: [PATCH 5.16 0486/1039] ASoC: rt5663: Handle device_property_read_u32_array error codes Date: Mon, 24 Jan 2022 19:37:55 +0100 Message-Id: <20220124184141.608319251@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jiasheng Jiang [ Upstream commit 2167c0b205960607fb136b4bb3c556a62be1569a ] The return value of device_property_read_u32_array() is not always 0. To catch the exception in case that devm_kzalloc failed and the rt5663->imp_table was NULL, which caused the failure of device_property_read_u32_array. Fixes: 450f0f6a8fb4 ("ASoC: rt5663: Add the manual offset field to compensate the DC offset") Signed-off-by: Jiasheng Jiang Link: https://lore.kernel.org/r/20211215031550.70702-1-jiasheng@iscas.ac.cn Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/codecs/rt5663.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/sound/soc/codecs/rt5663.c b/sound/soc/codecs/rt5663.c index 0389b2bb360e2..2138f62e6af5d 100644 --- a/sound/soc/codecs/rt5663.c +++ b/sound/soc/codecs/rt5663.c @@ -3461,6 +3461,7 @@ static void rt5663_calibrate(struct rt5663_priv *rt5663) static int rt5663_parse_dp(struct rt5663_priv *rt5663, struct device *dev) { int table_size; + int ret; device_property_read_u32(dev, "realtek,dc_offset_l_manual", &rt5663->pdata.dc_offset_l_manual); @@ -3477,9 +3478,11 @@ static int rt5663_parse_dp(struct rt5663_priv *rt5663, struct device *dev) table_size = sizeof(struct impedance_mapping_table) * rt5663->pdata.impedance_sensing_num; rt5663->imp_table = devm_kzalloc(dev, table_size, GFP_KERNEL); - device_property_read_u32_array(dev, + ret = device_property_read_u32_array(dev, "realtek,impedance_sensing_table", (u32 *)rt5663->imp_table, table_size); + if (ret) + return ret; } return 0; @@ -3504,8 +3507,11 @@ static int rt5663_i2c_probe(struct i2c_client *i2c, if (pdata) rt5663->pdata = *pdata; - else - rt5663_parse_dp(rt5663, &i2c->dev); + else { + ret = rt5663_parse_dp(rt5663, &i2c->dev); + if (ret) + return ret; + } for (i = 0; i < ARRAY_SIZE(rt5663->supplies); i++) rt5663->supplies[i].supply = rt5663_supply_names[i]; -- 2.34.1