From patchwork Wed Nov 29 16:17:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arvind Yadav X-Patchwork-Id: 10082849 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 207AA60353 for ; Wed, 29 Nov 2017 16:58:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0BFD629B37 for ; Wed, 29 Nov 2017 16:58:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F3D1429B62; Wed, 29 Nov 2017 16:58:39 +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 91C0E29B37 for ; Wed, 29 Nov 2017 16:58:39 +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=nyWW7cKSZzeB+uVyXapKMGytYy55XEObQ52xF0SryR4=; b=kYJS+CowQP6p8waB5eIhh6xCWL wbdLiamJq3giVS1VnNuaqPv6PDEy8jm3SC34ZE9h3bcAOSTVYOud2HTtk7XkzngnOWVHwrcbAt90B MIIKCGuFL7ln81Yj6yc2Khm3cLKx6QzbdW/PsUhyQ4MxD3k/qz/Tf9YlWtkVVDvIEM1BZIk5JM5Sr CC97HPrK9rMCuQfPlJg1JQUmcwWy1MoS2PMFQtjATBltz1jMcHuvwljEseNJu1O/oJngCTgDXVoon +UWwqCfJC1y4adVunJ6fHz6YKUQqtTZVllAo9QGsA0ZXSS5TV9wAWS+0bflq6lnhQrGn6194cbT1p GwGbaz8w==; 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 1eK5h0-00028u-Ad; Wed, 29 Nov 2017 16:58:38 +0000 Received: from mail-pg0-x241.google.com ([2607:f8b0:400e:c05::241]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eK53v-0006lk-0K; Wed, 29 Nov 2017 16:18:17 +0000 Received: by mail-pg0-x241.google.com with SMTP id w7so1700225pgv.6; Wed, 29 Nov 2017 08:17:54 -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=jfv4Q3I6rTBd1J7DF28R6XCtRzO2zh+6tRoK8S4cTzI=; b=HtiDVFXSh01uSOVFh7+OpRrKITRZdAsIY3Hcu8DUeGU93Q+21VTmr2UOdMOuohqrj7 BSZqqylRfJQrdy8Gg68k9Nx4gwZxRuPA7fhbJ4wAqILGTmOjPu+7ndf25xnrytRQR11W aZvX60Bfac9NtQVL8t9iTXY0pE+tU+KSNvn4amRWY/tPd6TYwGTEvQ6/OcKm3fs5YMDf STbkxd0WAiUdsjP2GXglYuz3KF+eOm4nWnVbnppwQ88eSJAsLD0qhKoHKgDITnXo6em4 HsvC9lDUvDomzzKvKTV8+oQ3dheH1tE1IubeBbEZOQ+Bt+d1KxDavFDGt2kKIZhmjGrW xCaA== 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=jfv4Q3I6rTBd1J7DF28R6XCtRzO2zh+6tRoK8S4cTzI=; b=XajKWHp2illBnBfJa/WmKldR3uCKrxfrOcrxcEx9Hh1DBYRNddI7rQ24TAHcttEzeC 7lX7WjW5aAXdem5nbvhtspGkGdrYpIsMz/bs0WI7otGAc+8LiSRJnUJYewPwWmisZpof YYvochSphPn69lz/crJfAhntfzPDJUeBACTKRzcHCPt9m81038Nnlnt2YZ0uCE+VKm3V sj343NWplASw0iNTPs0qt0/PyaOAX3u1cX9tOqB/z2ApzV6ZkFAQ9kSglUVHKRQ+7vj6 4sZ0ReAil6PmAwh2tDxNiEgK5l3mNJjN9yr5/2kL0ImM5Abo3OFm2LaTrUQeLkrdcxeL W3hA== X-Gm-Message-State: AJaThX62rDalCkV0Jy5Ux8myEqq/KhDEqhocBNjiTSr8mJcs0wVgVrpE G2h1+i8A8U05aSKQzUyYLbw= X-Google-Smtp-Source: AGs4zMZmHb1J5qFmz+p/vPZsfubwNUV9RmiMF9AoIIQwRdHq9lFNhull34k5sZ+phO5eUK/V2lQN+g== X-Received: by 10.99.6.23 with SMTP id 23mr3271526pgg.276.1511972274383; Wed, 29 Nov 2017 08:17:54 -0800 (PST) Received: from localhost.localdomain ([103.16.68.147]) by smtp.gmail.com with ESMTPSA id q74sm3867400pfd.134.2017.11.29.08.17.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 29 Nov 2017 08:17:53 -0800 (PST) From: Arvind Yadav To: lgirdwood@gmail.com, broonie@kernel.org, perex@perex.cz, tiwai@suse.com, matthias.bgg@gmail.com Subject: [PATCH 4/5 v4] ASoC: intel: sst: Handle return value of platform_get_irq Date: Wed, 29 Nov 2017 21:47:13 +0530 Message-Id: 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171129_081815_483263_4B99AB65 X-CRM114-Status: UNSURE ( 9.67 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-mediatek@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-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP platform_get_irq() can fail here and we must check its return value. Signed-off-by: Arvind Yadav --- changes in v2 : Add failure case '<= 0' instead of '< 0'. IRQ0 is not valid. changes in v3 : Return -EIO insted of ctx->irq_num. changes in v4 : Add separate error for irq == 0 and irq < 0. sound/soc/intel/atom/sst/sst_acpi.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sound/soc/intel/atom/sst/sst_acpi.c b/sound/soc/intel/atom/sst/sst_acpi.c index 0e928d5..aec7408 100644 --- a/sound/soc/intel/atom/sst/sst_acpi.c +++ b/sound/soc/intel/atom/sst/sst_acpi.c @@ -236,6 +236,9 @@ static int sst_platform_get_resources(struct intel_sst_drv *ctx) /* Find the IRQ */ ctx->irq_num = platform_get_irq(pdev, ctx->pdata->res_info->acpi_ipc_irq_index); + if (ctx->irq_num <= 0) + return ctx->irq_num < 0 ? ctx->irq_num : -EIO; + return 0; }