From patchwork Wed Nov 29 16:17:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arvind Yadav X-Patchwork-Id: 10082713 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0F26E6020B for ; Wed, 29 Nov 2017 16:18:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EF68429B10 for ; Wed, 29 Nov 2017 16:18:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E477229B1E; Wed, 29 Nov 2017 16:18:20 +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=-1.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, T_DKIM_INVALID autolearn=no 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 404D029B1B for ; Wed, 29 Nov 2017 16:18:20 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 42B9E26790F; Wed, 29 Nov 2017 17:17:56 +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 DF3FC267910; Wed, 29 Nov 2017 17:17:54 +0100 (CET) Received: from mail-pf0-f196.google.com (mail-pf0-f196.google.com [209.85.192.196]) by alsa0.perex.cz (Postfix) with ESMTP id 8D0B6267426 for ; Wed, 29 Nov 2017 17:17:52 +0100 (CET) Received: by mail-pf0-f196.google.com with SMTP id a90so1773284pfk.1 for ; Wed, 29 Nov 2017 08:17:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=/5euh2mLno/aGnVw43dtgHt5f2grqCUp6fMSHHrBK9I=; b=B+wKHr1bri7dbeD7Xm/Knp2itU5LStu/7cced/LxKBZ63xpszGo/iiy53QE4Yj7Nt2 vOVF78gvyXPGSB9JNlulIRiVskjftXAq1HLPVMZ9+FHSt1xHq6DqNX8s1dxRVi8wa4rN XHXiFdCkaHfPQpBhpTs1iJNeb2xjaG+vv0K2wjvP0KPjMUunRGF1kyVvBluhHOJZcHwH EReL/ipM5eRR80n3xXfc1XPyD9sxClFkCTXsM3H2OQqNMLCNX9wdwXbDzjBuFgQHacbk H2Wt9SCHULYWmF0N+NW62xfdf28VG0vEGThoQoxNrJnI+V6CBbhGvzmqpyZQDni+y404 9JZg== 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:in-reply-to :references:in-reply-to:references; bh=/5euh2mLno/aGnVw43dtgHt5f2grqCUp6fMSHHrBK9I=; b=oGmkZUGvxl4EMj8sf9GcqpekNXcQ4CQ80mTij+6IzJjkuOrmSI1FmzV1X2c/gyhmDT Zok+XAMaF5tUSw5gV8ICxGC3fms1YxSJts8/s+njWWIyEAUzqBMhfETX1XRgn592KeSg RJ8pvXwysFTlxi6Yj7aIVtGNvMzr4qbi/HeNj16wT2sfJO+WTp3qGPfKdzZ6hk666kVL 77Amunw+Byg78mZIDxSmHhaPe9HKYqkf30YhlrExmSBlbWOF60RgvtDrkdjW+avodRaB ix5zFxT/1aM8tzEORkA1EaR0AMW9rLyN7FkL1diFqJ9fS2pr8mjsSkrNISYXAwdZw8Sh w8tw== X-Gm-Message-State: AJaThX6HM78Fv7D3TxYIcGQvFwhxDErpfDWbLeWlVVMdG2weEXj93ghZ +Fu0g/r6tSRWc4UikPBn5Jw= X-Google-Smtp-Source: AGs4zMYy3ac9yADftTX26MA+gYnG0HU+zWyKDy7U0M3bwV7xRrcwCoW3bTy6V5lgmGqDtfVxSu8rPg== X-Received: by 10.101.96.35 with SMTP id p3mr3257521pgu.230.1511972271112; Wed, 29 Nov 2017 08:17:51 -0800 (PST) Received: from localhost.localdomain ([103.16.68.147]) by smtp.gmail.com with ESMTPSA id q74sm3867400pfd.134.2017.11.29.08.17.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 29 Nov 2017 08:17:50 -0800 (PST) From: Arvind Yadav To: lgirdwood@gmail.com, broonie@kernel.org, perex@perex.cz, tiwai@suse.com, matthias.bgg@gmail.com Date: Wed, 29 Nov 2017 21:47:12 +0530 Message-Id: <0703b0d6d8ba826a42f244eec6bce71514edd563.1511970158.git.arvind.yadav.cs@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <4ce907b8389af30eb0677e70cf543a2b795cca12.1511970158.git.arvind.yadav.cs@gmail.com> References: <4ce907b8389af30eb0677e70cf543a2b795cca12.1511970158.git.arvind.yadav.cs@gmail.com> In-Reply-To: <4ce907b8389af30eb0677e70cf543a2b795cca12.1511970158.git.arvind.yadav.cs@gmail.com> References: <4ce907b8389af30eb0677e70cf543a2b795cca12.1511970158.git.arvind.yadav.cs@gmail.com> Cc: alsa-devel@alsa-project.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [alsa-devel] [PATCH 3/5 v5] ASoC: nuc900: Fix platform_get_irq's error checking 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 The platform_get_irq() function returns negative if an error occurs. zero or positive number on success. platform_get_irq() error checking for zero is not correct. Signed-off-by: Arvind Yadav --- changes in v2 : irq was unsigned. so using signed variable ret. changes in v3 : Add failure case '<= 0' instead of '< 0'. IRQ0 is not valid. changes in v4 : Return -EBUSY insted of irq. changes in v5 : Add separate error for irq == 0 and irq < 0. sound/soc/nuc900/nuc900-ac97.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/soc/nuc900/nuc900-ac97.c b/sound/soc/nuc900/nuc900-ac97.c index b6615af..5e4fbd2 100644 --- a/sound/soc/nuc900/nuc900-ac97.c +++ b/sound/soc/nuc900/nuc900-ac97.c @@ -346,8 +346,8 @@ static int nuc900_ac97_drvprobe(struct platform_device *pdev) } nuc900_audio->irq_num = platform_get_irq(pdev, 0); - if (!nuc900_audio->irq_num) { - ret = -EBUSY; + if (nuc900_audio->irq_num <= 0) { + ret = nuc900_audio->irq_num < 0 ? nuc900_audio->irq_num : -EBUSY; goto out; }