From patchwork Sat Jan 5 13:44:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aditya Pakki X-Patchwork-Id: 10750049 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F3F076C5 for ; Mon, 7 Jan 2019 07:08:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E021428712 for ; Mon, 7 Jan 2019 07:08:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D1C8E28882; Mon, 7 Jan 2019 07:08:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1719728712 for ; Mon, 7 Jan 2019 07:08:02 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 08D27267960; Mon, 7 Jan 2019 08:07:13 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id CE4FC267CA7; Sat, 5 Jan 2019 14:44:48 +0100 (CET) Received: from mta-p8.oit.umn.edu (mta-p8.oit.umn.edu [134.84.196.208]) by alsa0.perex.cz (Postfix) with ESMTP id BB207267B61 for ; Sat, 5 Jan 2019 14:44:43 +0100 (CET) Received: from localhost (unknown [127.0.0.1]) by mta-p8.oit.umn.edu (Postfix) with ESMTP id 107D2D38 for ; Sat, 5 Jan 2019 13:44:42 +0000 (UTC) X-Virus-Scanned: amavisd-new at umn.edu Received: from mta-p8.oit.umn.edu ([127.0.0.1]) by localhost (mta-p8.oit.umn.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 3W39bh28qjea for ; Sat, 5 Jan 2019 07:44:41 -0600 (CST) Received: from mail-it1-f199.google.com (mail-it1-f199.google.com [209.85.166.199]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mta-p8.oit.umn.edu (Postfix) with ESMTPS id E1201BA5 for ; Sat, 5 Jan 2019 07:44:41 -0600 (CST) Received: by mail-it1-f199.google.com with SMTP id 128so3752365itw.8 for ; Sat, 05 Jan 2019 05:44:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=umn.edu; s=google; h=from:to:cc:subject:date:message-id; bh=lLxaO63rYyD+jCJ0zBgxSgVfZ1K3zX1gcZ9xN4ObIrA=; b=F+RQu45zZp+KqDpCUoHpW34XjeovKX3t5cSoiOixzvBvwkijByYE+EFYwLIzZDbhHv kgsOQsHKFahBDMv11h7VYpDJGdw4RqhX2P3u+gfWfqzbBbIcUjnWQgBe6S2anXlMoVQT qE5UHpspXJp5m1gSqYWaG3MGDoclbcA6otlXu8Rb1s+SdkTU2yi/9QXrskEv8bsq+p9L riThdQCABP7HuoUJjtzLfQoZeKdeECTlR1xcGn3bYxdsfbnpKOqnYhWpMG6S/s/DLtdb O06TxZilshghHeIXa8IOTZf3q2J3P1BU18HycqiQEyQsKkMUdejDjSbSKm7A+bVfwsMc QMfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=lLxaO63rYyD+jCJ0zBgxSgVfZ1K3zX1gcZ9xN4ObIrA=; b=t8Lj/7v9biLjrSjXZuH/lC7rCD15yB/hmSXUy1ZuiMuTeWMfyUIVauUysqcivWYgtD 6gxyc4OVpEZ/O2pQDAcuhuAfTeXjW4ZOUEgcbZCpalQCgtEiS9Ek1s5hascxaynaOuZT gQ2aUHdB0nWBNaHrw45fPOR6HIL5KvZ4AsJdkgKXVMXGlm30s+R1sBzhOvGLe+B9Vtyp kniB+OuMhHMQOrrzNODYXQXiz9jQlLqZP5ypz4dpANhANQSNwRFcsCOy0NvU2fp0y5hC blKuJ0LgwF8ygvYfK1TN8hHjzj7ilu3srpJBGOPf/Sv8jhZKPmhT9ebCOOCZEFdxvE+C lnxw== X-Gm-Message-State: AJcUukdCVFYL5IMkcIkaix5io/JGM3b3rPlcf7gs+zBwlF8N+qakcJJd sE6jACJu514/49HcbCJTBrJfAqFI0IM0ANhiJjYEnxMZgr40hocpSLqOcDYfLAMMj92U84U2ZA3 elg4YEOXQZhOE68lTBR9yLQkz4Fs= X-Received: by 2002:a24:784a:: with SMTP id p71mr3780729itc.158.1546695881133; Sat, 05 Jan 2019 05:44:41 -0800 (PST) X-Google-Smtp-Source: ALg8bN6eypdpDkog8fHNJNEm7TtBZEGAXtw5rHbUxoS80E7UXSm0Q0dZ+vc18FRwuLHKUX4kOB8k4g== X-Received: by 2002:a24:784a:: with SMTP id p71mr3780706itc.158.1546695880805; Sat, 05 Jan 2019 05:44:40 -0800 (PST) Received: from cs-u-syssec1.cs.umn.edu (cs-u-syssec1.cs.umn.edu. [134.84.121.78]) by smtp.gmail.com with ESMTPSA id f4sm11671124iop.70.2019.01.05.05.44.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 05 Jan 2019 05:44:40 -0800 (PST) From: Aditya Pakki To: pakki001@umn.edu Date: Sat, 5 Jan 2019 07:44:27 -0600 Message-Id: <20190105134427.1022-1-pakki001@umn.edu> X-Mailer: git-send-email 2.17.1 X-Mailman-Approved-At: Mon, 07 Jan 2019 08:06:57 +0100 Cc: Oder Chiou , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Takashi Iwai , kjlu@umn.edu, Liam Girdwood , Mark Brown , Bard Liao Subject: [alsa-devel] [PATCH] ASoC: rt5663: Fix error handling of device_property_read_u32_array X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP In rt5663_parse_dp, the function device_property_read_u32_array() can return an error. This fix adds a check to the latter as well as to the callsite of rt5663_parse_dp in rt5663_i2c_probe. Signed-off-by: Aditya Pakki --- sound/soc/codecs/rt5663.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sound/soc/codecs/rt5663.c b/sound/soc/codecs/rt5663.c index da6647015708..2678842d8cd4 100644 --- a/sound/soc/codecs/rt5663.c +++ b/sound/soc/codecs/rt5663.c @@ -3480,7 +3480,7 @@ 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, + return device_property_read_u32_array(dev, "realtek,impedance_sensing_table", (u32 *)rt5663->imp_table, table_size); } @@ -3507,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];