Received: by 2002:ac0:8845:0:0:0:0:0 with SMTP id g63csp633828img; Thu, 28 Feb 2019 05:30:26 -0800 (PST) X-Google-Smtp-Source: APXvYqxU4ERG7NkaXQX3J8yPud764L2so79QZ7Sdc9tebkhCPIrkkwlRcoiLEOGUSk0K1u05qlSS X-Received: by 2002:a63:7909:: with SMTP id u9mr4483517pgc.243.1551360626652; Thu, 28 Feb 2019 05:30:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551360626; cv=none; d=google.com; s=arc-20160816; b=t51y4GpxCTeEDIxvlBWbTJ0aZF4JcA9ms1JV3A+IH5Dq4J5+nP9h9P97/ap5nhf1Tt xIiF3W4+9FLsFdgjrHbdTGh1aYJUZgR0EDSccHkDl07ZODgsMklWFzbqGylu3KBERpDi JkP6f9bPMnnMEGwj0a10YsckQ+PzuuKc+uyjiJYwJ/R4WNYYnMRHVU/4AzV8AfIAvKuz cT2TUX5w4Cer4CCV8Lr6CnJH4CUJQiUqEu19/2EAj+HuQ03Up537hqOL9tkx7glYa/1k Hcr+udz9AQj+yeLqMC570hg+zhKd8EJnZe+bE85JEwdiQ5sup4uvq7+KhmPGKcv69QYC ciSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:to:from; bh=kI/YydLdPFLdwPcIQnXyG4BNKPZgROc/HKT2zoWuJOA=; b=DxOYbYU5eOtqgK8wwW1olmoEsPGWm3y45Qy9GA4n5IeRZcBpFPy2IgE9odojcXE3g7 uxfz9EqmJIj71/K4GTvqyYxlqZqJOexXZu9sV+2Zavo6kXjFLCFyVYZ9+sRqxqwP4PDJ gKTklOPsIeuC4EFRDsnwiGWUBKqVHOQBuDOTywdlBpf02jYip48IWa662ZxCaXbyXmWM ASuemCb+FLrafCJNb98OJcjLw4zFeicbJq1ZB4cF/aZcE45KzRDtCGoBXx6osca4Rx43 avMez9eMeBU28mrBET1uk8WHG6MEv89z7vaFmHJRi67UbH3ngdCGPUkF3U1qn3ZWRMkY na3A== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k16si15137617pfj.174.2019.02.28.05.30.10; Thu, 28 Feb 2019 05:30:26 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732781AbfB1NUT (ORCPT + 99 others); Thu, 28 Feb 2019 08:20:19 -0500 Received: from mx07-00178001.pphosted.com ([62.209.51.94]:9597 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727499AbfB1NUR (ORCPT ); Thu, 28 Feb 2019 08:20:17 -0500 Received: from pps.filterd (m0046037.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x1SDGXmp014411; Thu, 28 Feb 2019 14:19:36 +0100 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 2qtvtxcub8-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Thu, 28 Feb 2019 14:19:36 +0100 Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 55D3431; Thu, 28 Feb 2019 13:19:36 +0000 (GMT) Received: from Webmail-eu.st.com (Safex1hubcas21.st.com [10.75.90.44]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 2C5FA56C0; Thu, 28 Feb 2019 13:19:36 +0000 (GMT) Received: from SAFEX1HUBCAS24.st.com (10.75.90.95) by SAFEX1HUBCAS21.st.com (10.75.90.44) with Microsoft SMTP Server (TLS) id 14.3.361.1; Thu, 28 Feb 2019 14:19:36 +0100 Received: from localhost (10.201.23.16) by webmail-ga.st.com (10.75.90.48) with Microsoft SMTP Server (TLS) id 14.3.361.1; Thu, 28 Feb 2019 14:19:35 +0100 From: Olivier Moysan To: , , , , , , , , , , , , Subject: [PATCH 5/5] ASoC: stm32: sai: fix set_sync service Date: Thu, 28 Feb 2019 14:19:25 +0100 Message-ID: <1551359965-25228-6-git-send-email-olivier.moysan@st.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1551359965-25228-1-git-send-email-olivier.moysan@st.com> References: <1551359965-25228-1-git-send-email-olivier.moysan@st.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.201.23.16] X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-02-28_06:,, signatures=0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add error check on set_sync function return. Add of_node_put() as of_get_parent() takes a reference which has to be released. Signed-off-by: Olivier Moysan --- sound/soc/stm/stm32_sai.c | 8 +++++--- sound/soc/stm/stm32_sai_sub.c | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/sound/soc/stm/stm32_sai.c b/sound/soc/stm/stm32_sai.c index 14c9591aae42..d68d62f12df5 100644 --- a/sound/soc/stm/stm32_sai.c +++ b/sound/soc/stm/stm32_sai.c @@ -105,6 +105,7 @@ static int stm32_sai_set_sync(struct stm32_sai_data *sai_client, if (!pdev) { dev_err(&sai_client->pdev->dev, "Device not found for node %pOFn\n", np_provider); + of_node_put(np_provider); return -ENODEV; } @@ -113,19 +114,20 @@ static int stm32_sai_set_sync(struct stm32_sai_data *sai_client, dev_err(&sai_client->pdev->dev, "SAI sync provider data not found\n"); ret = -EINVAL; - goto out_put_dev; + goto error; } /* Configure sync client */ ret = stm32_sai_sync_conf_client(sai_client, synci); if (ret < 0) - goto out_put_dev; + goto error; /* Configure sync provider */ ret = stm32_sai_sync_conf_provider(sai_provider, synco); -out_put_dev: +error: put_device(&pdev->dev); + of_node_put(np_provider); return ret; } diff --git a/sound/soc/stm/stm32_sai_sub.c b/sound/soc/stm/stm32_sai_sub.c index cb658463ccd1..55d802f51c15 100644 --- a/sound/soc/stm/stm32_sai_sub.c +++ b/sound/soc/stm/stm32_sai_sub.c @@ -1106,7 +1106,7 @@ static int stm32_sai_pcm_new(struct snd_soc_pcm_runtime *rtd, static int stm32_sai_dai_probe(struct snd_soc_dai *cpu_dai) { struct stm32_sai_sub_data *sai = dev_get_drvdata(cpu_dai->dev); - int cr1 = 0, cr1_mask; + int cr1 = 0, cr1_mask, ret; sai->cpu_dai = cpu_dai; @@ -1136,8 +1136,10 @@ static int stm32_sai_dai_probe(struct snd_soc_dai *cpu_dai) /* Configure synchronization */ if (sai->sync == SAI_SYNC_EXTERNAL) { /* Configure synchro client and provider */ - sai->pdata->set_sync(sai->pdata, sai->np_sync_provider, - sai->synco, sai->synci); + ret = sai->pdata->set_sync(sai->pdata, sai->np_sync_provider, + sai->synco, sai->synci); + if (ret) + return ret; } cr1_mask |= SAI_XCR1_SYNCEN_MASK; -- 2.7.4