From patchwork Wed Dec 26 21:11:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gustavo A. R. Silva" X-Patchwork-Id: 10743305 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 117AC13A4 for ; Wed, 26 Dec 2018 21:11:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EA6D52870F for ; Wed, 26 Dec 2018 21:11:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C6D7A28717; Wed, 26 Dec 2018 21:11:19 +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.9 required=2.0 tests=BAYES_00,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 D7C4F2870F for ; Wed, 26 Dec 2018 21:11:18 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id AF899267B06; Wed, 26 Dec 2018 22:11:16 +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 71A31267B08; Wed, 26 Dec 2018 22:11:14 +0100 (CET) Received: from gateway23.websitewelcome.com (gateway23.websitewelcome.com [192.185.50.185]) by alsa0.perex.cz (Postfix) with ESMTP id 5693E267AF4 for ; Wed, 26 Dec 2018 22:11:10 +0100 (CET) Received: from cm13.websitewelcome.com (cm13.websitewelcome.com [100.42.49.6]) by gateway23.websitewelcome.com (Postfix) with ESMTP id 9E65C203AE for ; Wed, 26 Dec 2018 15:11:08 -0600 (CST) Received: from gator4166.hostgator.com ([108.167.133.22]) by cmsmtp with SMTP id cGSKgRs2qYTGMcGSKgFpg5; Wed, 26 Dec 2018 15:11:08 -0600 X-Authority-Reason: nr=8 Received: from [189.250.78.104] (port=54028 helo=embeddedor) by gator4166.hostgator.com with esmtpa (Exim 4.91) (envelope-from ) id 1gcGSJ-003Bzu-I8; Wed, 26 Dec 2018 15:11:07 -0600 Date: Wed, 26 Dec 2018 15:11:06 -0600 From: "Gustavo A. R. Silva" To: Maruthi Srinivas Bayyavarapu , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Michal Simek Message-ID: <20181226211106.GA16692@embeddedor> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.9.4 (2018-02-28) X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator4166.hostgator.com X-AntiAbuse: Original Domain - alsa-project.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - embeddedor.com X-BWhitelist: no X-Source-IP: 189.250.78.104 X-Source-L: No X-Exim-ID: 1gcGSJ-003Bzu-I8 X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: (embeddedor) [189.250.78.104]:54028 X-Source-Auth: gustavo@embeddedor.com X-Email-Count: 7 X-Source-Cap: Z3V6aWRpbmU7Z3V6aWRpbmU7Z2F0b3I0MTY2Lmhvc3RnYXRvci5jb20= X-Local-Domain: yes Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, "Gustavo A. R. Silva" Subject: [alsa-devel] [PATCH] ASoC: xlnx: fix error handling in xlnx_formatter_pcm_probe 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP Currently, if platform_get_irq_byname() fails, the returned error turns into a huge value, once it is being store into a variable of type unsigned int, hence never actually reporting any error and causing unexpected behavior when using the values stored in aud_drv_data->s2mm_irq and aud_drv_data->mm2s_irq. Fix this by changing the type of variables s2mm_irq and mm2s_irq in structure xlnx_pcm_drv_data from unsigned int to int. Addresses-Coverity-ID: 1476096 ("Unsigned compared against 0") Fixes: 796175a94a7f ("ASoC: xlnx: add pcm formatter platform driver") Signed-off-by: Gustavo A. R. Silva --- sound/soc/xilinx/xlnx_formatter_pcm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/soc/xilinx/xlnx_formatter_pcm.c b/sound/soc/xilinx/xlnx_formatter_pcm.c index f7235f7664d7..d2194da928e7 100644 --- a/sound/soc/xilinx/xlnx_formatter_pcm.c +++ b/sound/soc/xilinx/xlnx_formatter_pcm.c @@ -76,8 +76,8 @@ struct xlnx_pcm_drv_data { void __iomem *mmio; bool s2mm_presence; bool mm2s_presence; - unsigned int s2mm_irq; - unsigned int mm2s_irq; + int s2mm_irq; + int mm2s_irq; struct snd_pcm_substream *play_stream; struct snd_pcm_substream *capture_stream; struct clk *axi_clk;