From patchwork Thu Jun 14 13:51:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhouyang Jia X-Patchwork-Id: 10464169 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 D0EB6601F9 for ; Thu, 14 Jun 2018 13:52:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BF6C728979 for ; Thu, 14 Jun 2018 13:52:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B4584289B5; Thu, 14 Jun 2018 13:52:01 +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.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, T_DKIM_INVALID 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 A3732289B0 for ; Thu, 14 Jun 2018 13:52:00 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id DF16B267601; Thu, 14 Jun 2018 15:51:58 +0200 (CEST) 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 8E5EC267614; Thu, 14 Jun 2018 15:51:56 +0200 (CEST) Received: from mail-pf0-f193.google.com (mail-pf0-f193.google.com [209.85.192.193]) by alsa0.perex.cz (Postfix) with ESMTP id 6C8942675D2 for ; Thu, 14 Jun 2018 15:51:53 +0200 (CEST) Received: by mail-pf0-f193.google.com with SMTP id a22-v6so3275638pfo.12 for ; Thu, 14 Jun 2018 06:51:53 -0700 (PDT) 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; bh=2ZzX8dTvjPdCp7FNvAwTTTiJERDlJcWWXgpZ/dPXD58=; b=O6IbUw427ELPmDFk8MqBFBCdGGlPVUvZe1EzUJbqQD+nHyEMMlS8NM1h+4HSnDAlGF x82fVpXDimR7b53gDr1HoxvTWdkDsKMYRxQDqaXUm41HkGJyvTY3IfRnxXHmPCpmVIhQ 04f36T9yV7LOP2iMl89K83D4JrrqlJBVbYt2N/1z0ELGtwbFdVdtd12zNcuuIIp4ijb/ rUexpULvlQLP5FREMx6J5VRosk43FAIhtiEIMEieIa3Y0rnrdQMr2SdxzCPKFVZyw6/8 4BKw03Xd6dyI/PCplzstqecpc7JIBfsvVwoZpsUUHk2+qoaVIhSZBzhYQpSD9acmDPdy lrzA== 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; bh=2ZzX8dTvjPdCp7FNvAwTTTiJERDlJcWWXgpZ/dPXD58=; b=W8ZVT4F712DTHrjvCqkUyxrBTB8w6Ee0eUHpimLI2hsI5Ew9AuCTVlPJ4Qh4DrPtQU grLDg+9Z9RWb1LtIWIDE3gYyyYbaWVo+3leRvGTWHO24I3mSbEvTOtFevJwlpaF9IuDF RWVxLWC6XmkdL2p2mpIDP8bpMVSog7Ue3XhLL0heFjCy0d/5+s3Fsj4iGkAjVr34v8cD CE9wbYRhEhm0uW7VkSwkIjsk0AvAg9o/uaa8tOCK4OBOYwuaTL8ALJDaaMfOAwV6kPdc CocziZL9mN93FxmZRMEA51csHOQ24ct5Uq2fmErliemZD71X6geWgCpyujhk3NWtrXMX Xiqg== X-Gm-Message-State: APt69E19mD+vrjQrxtB8RJbStIvwYI1sxBYx1KyX0QxPp41tq/j3B6HF V+7PyX+IrS30Hsl52g2pvlI= X-Google-Smtp-Source: ADUXVKKgLgzyVz547mQUoq3ZewixEB3CyYzQFJeyW0RqK1c8u+63HcHZoEFP0Q5Wkx4csNybKiStkQ== X-Received: by 2002:a65:5348:: with SMTP id w8-v6mr2449300pgr.247.1528984313128; Thu, 14 Jun 2018 06:51:53 -0700 (PDT) Received: from localhost ([103.88.46.82]) by smtp.gmail.com with ESMTPSA id n76-v6sm12746749pfg.98.2018.06.14.06.51.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Jun 2018 06:51:52 -0700 (PDT) From: Zhouyang Jia To: Date: Thu, 14 Jun 2018 21:51:46 +0800 Message-Id: <1528984308-53122-1-git-send-email-jiazhouyang09@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1528773796-37922-1-git-send-email-jiazhouyang09@gmail.com> References: <1528773796-37922-1-git-send-email-jiazhouyang09@gmail.com> Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Takashi Iwai , Zhouyang Jia , Bhumika Goyal Subject: [alsa-devel] [PATCH v2] ALSA: lx6464es: add error handling for pci_ioremap_bar 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 When pci_ioremap_bar fails, the lack of error-handling code may cause unexpected results. This patch adds error-handling code after calling pci_ioremap_bar. Signed-off-by: Zhouyang Jia --- v1->v2: - Add new goto label. --- sound/pci/lx6464es/lx6464es.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sound/pci/lx6464es/lx6464es.c b/sound/pci/lx6464es/lx6464es.c index 9655b08..6c85f13 100644 --- a/sound/pci/lx6464es/lx6464es.c +++ b/sound/pci/lx6464es/lx6464es.c @@ -1016,6 +1016,10 @@ static int snd_lx6464es_create(struct snd_card *card, /* dsp port */ chip->port_dsp_bar = pci_ioremap_bar(pci, 2); + if (!chip->port_dsp_bar) { + dev_err(card->dev, "cannot remap PCI memory region\n"); + goto remap_pci_failed; + } err = request_threaded_irq(pci->irq, lx_interrupt, lx_threaded_irq, IRQF_SHARED, KBUILD_MODNAME, chip); @@ -1055,6 +1059,9 @@ static int snd_lx6464es_create(struct snd_card *card, free_irq(pci->irq, chip); request_irq_failed: + iounmap(chip->port_dsp_bar); + +remap_pci_failed: pci_release_regions(pci); request_regions_failed: