From patchwork Sun Nov 19 04:15:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arvind Yadav X-Patchwork-Id: 10065011 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 05996602CB for ; Sun, 19 Nov 2017 04:17:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E78572952A for ; Sun, 19 Nov 2017 04:17:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DC53B29530; Sun, 19 Nov 2017 04:17:00 +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=-4.2 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FROM, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A2AA02952A for ; Sun, 19 Nov 2017 04:17:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=XUOqDCpzTMUusSzS4Cv4jSgdRYle9FRIizEZ+26CRtY=; b=MrcHqDro9Caodc0HvkVKmShQnA C5MbaFF3alAJOOfopU+z/o2CJ+ua+dsJ4ezY1EiR5hHit5Y6D8Cj0zrGxi6MVecXDWWZNkVn8lX3T 2c8bFiATVSLiTkvAGBw6u804OiEj4fa6AiAzOQuz1rmzaSdnqwWVELdBa98kO1YDhDdZV1XnIYQBs zBFgbgpIBUBvCUZ0IFrQL3kMcbyhkcQwwx4DES06g2pNpiw1z8X0dwIkrnWIPhVlIqUMb2JjuWprm sxB+v6I98i9ScTMOsr3opNj67O4qGaTOW0vcjU0aCePlqPmCcJQkYJmNX99IeYi3JhP2TCynco1TF QkrZENMg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1eGH2S-0000er-3N; Sun, 19 Nov 2017 04:17:00 +0000 Received: from mail-pg0-x244.google.com ([2607:f8b0:400e:c05::244]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eGH1I-0007Ja-I6; Sun, 19 Nov 2017 04:15:54 +0000 Received: by mail-pg0-x244.google.com with SMTP id s75so4858150pgs.0; Sat, 18 Nov 2017 20:15:30 -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=P+sxC+or19mYfeucLu3FYkOEj99t089kWnhdgh5EB58=; b=KMTfpOaWI12yX4+UEGYv6vNHk4Q+YBbuTrkirILibMbH2PGtKrg5goLe+VVbXjjS4O wRDlWrLsQkP+o1tfQacdg7wZL9wUWPDuGEtn8ob3lwcNVUGkhC6fldNNgN8qhMISUK0f pwsDEA+HljIYhkq5NuQxTSBvFAajRz/UlWx7pp7w/0RDl8VeZcphMiDK5loOyKHV8u5s Ll4zDHbxh29aMj15CknObv7BLmOhEMTQpEdycjrw0Y9Oq+cWE8l8BlDbJ9eWNAvRtrGM 60r2ChhwnsZSQVoehGtSSgCcvlz0I+rk0rwu6Dv0T6RVYU6TpupY8tSCsy9B+eZI9cP/ EvPQ== 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=P+sxC+or19mYfeucLu3FYkOEj99t089kWnhdgh5EB58=; b=FmMTyOsPCq5pzUdTDbToLU8rsFswaxYMsG8INfrA3D9D6RauhizrqxYoKgx5SfzfLD e0QCBTjucW9fDPpOzkl+b06q/KF9PPGtElXkkGUemqjhrP8gr8+/ViyCTJ8bNTiiI5rH 4/yyHkD+PMacelujK1Vr4TM3cvT0AebrEWbzY3ggEn56mjf6XHRKKQLebAhy1VYEhxL9 4FKDm6T8olbZTh407pnwk7R3jfBZIFmzSMVWWBUL/ApD3mWeFgVeLNFM0eEBNl0P4bdi w5kk7vLcMgcGvRg3ZZwSZAFCGBpdxx8mDVHi3AS1eX3TrRYvAK5O6vkSjXjbnr0HzqIi v9eA== X-Gm-Message-State: AJaThX5/ftFlWinN/PL2fpjb3BzazYCxevi7BZtYboBcZK8Q09l0XMN8 BHj5Ty2uqRwLmLAjk8goZDU= X-Google-Smtp-Source: AGs4zMZKB+i2NnmydmGs14ljTkHMu1esth+zylCIR+BezCnG8ikIeXsCbjpA28yMsm/e9QfJnoWbeA== X-Received: by 10.159.229.136 with SMTP id az8mr9974180plb.59.1511064930065; Sat, 18 Nov 2017 20:15:30 -0800 (PST) Received: from localhost.localdomain ([103.16.68.147]) by smtp.gmail.com with ESMTPSA id l14sm12741475pgn.35.2017.11.18.20.15.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 18 Nov 2017 20:15:29 -0800 (PST) From: Arvind Yadav To: lgirdwood@gmail.com, broonie@kernel.org, perex@perex.cz, tiwai@suse.com, matthias.bgg@gmail.com, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux@armlinux.org.uk Subject: [PATCH 3/5 v4] ASoC: nuc900: Fix platform_get_irq's error checking Date: Sun, 19 Nov 2017 09:45:02 +0530 Message-Id: X-Mailer: git-send-email 2.7.4 In-Reply-To: <082d4479211d425219f4ab275ecc12e1011eca2f.1511062844.git.arvind.yadav.cs@gmail.com> References: <082d4479211d425219f4ab275ecc12e1011eca2f.1511062844.git.arvind.yadav.cs@gmail.com> In-Reply-To: <082d4479211d425219f4ab275ecc12e1011eca2f.1511062844.git.arvind.yadav.cs@gmail.com> References: <082d4479211d425219f4ab275ecc12e1011eca2f.1511062844.git.arvind.yadav.cs@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171118_201548_723293_02856DB7 X-CRM114-Status: GOOD ( 10.22 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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 -ENODEV insted of irq. sound/soc/nuc900/nuc900-ac97.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sound/soc/nuc900/nuc900-ac97.c b/sound/soc/nuc900/nuc900-ac97.c index b6615af..893ccf2 100644 --- a/sound/soc/nuc900/nuc900-ac97.c +++ b/sound/soc/nuc900/nuc900-ac97.c @@ -345,11 +345,12 @@ static int nuc900_ac97_drvprobe(struct platform_device *pdev) goto out; } - nuc900_audio->irq_num = platform_get_irq(pdev, 0); - if (!nuc900_audio->irq_num) { + ret = platform_get_irq(pdev, 0); + if (ret <= 0) { ret = -EBUSY; goto out; } + nuc900_audio->irq_num = ret; nuc900_ac97_data = nuc900_audio;