Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp1973957imm; Thu, 14 Jun 2018 06:54:12 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJ2r0jtVSRV6bACfz5iIIQum/cXiijD8kvHkkI8a2j3oTbgwRykfpea9wz5EoyYOX36VInw X-Received: by 2002:a65:5006:: with SMTP id f6-v6mr2443379pgo.116.1528984452292; Thu, 14 Jun 2018 06:54:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528984452; cv=none; d=google.com; s=arc-20160816; b=UN4t7kuYmD3uRDzrOKdUN66f2AjpGLJteBTy6T+k72VXubEJC2Lvr/7zptOAQnLOwg nxwKNrwIOgrVXIWjlNq3nXs/dbeE/ePDezThbEEtzuo492TmjMaoBHlyfmx0QtBqxlbx CHJD4Bz31z+amJ+xXcVJEW7DOAKq81y1Dy6ZqRCd5z+xRcr0dYoqNdzbiOi7irtQk8py Qg3dfJ2cnP5xA2FjMih8BxHy2IIjfNd18r/PPvJcgyjMQvvanvXjnFGJ1Q/2dp3PVtZy 1Yl+9CXdAR6hduHD/G3XPF1aas74j9onQbpqmbiTVN7ZZa1rtjkrF7orSdqoexit9rUd zWjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:in-reply-to:message-id:date :subject:cc:from:dkim-signature:arc-authentication-results; bh=2ZzX8dTvjPdCp7FNvAwTTTiJERDlJcWWXgpZ/dPXD58=; b=MOxtO9hwjZ/9Pp+giL8W5sKbN6DjRJPIyy4TVuR9IObySBsuLKwzK4J/5ALf+lucEL bMyjeqazst90nGm0DfX6sbJBQnm9WDxm/cP+RKLs05NN25VS+4d9CDLLoVGoepb8z2rb IbUppFQEJpEM0fBnoAv2/6uCg0FcL1+T5Me7Wp5tiXPskE7MiD6hOBneO1fQ/hP4qGo1 s4h5GPkJFWjIC+NFwaug3W/FkDplzBeygQs8DpjpOEWaq47VV0I/OAbTMn4X7ogCZdDC d2s4C6o/sHFFEM4qB5OTwYooMVDIZnGibx4/JRiGYvKq6c7Y/TixTbSYvy6XcD9BM6ey uttw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=O6IbUw42; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i65-v6si5319028pfg.218.2018.06.14.06.53.57; Thu, 14 Jun 2018 06:54:12 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=O6IbUw42; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755347AbeFNNvy (ORCPT + 99 others); Thu, 14 Jun 2018 09:51:54 -0400 Received: from mail-pf0-f196.google.com ([209.85.192.196]:35414 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754912AbeFNNvx (ORCPT ); Thu, 14 Jun 2018 09:51:53 -0400 Received: by mail-pf0-f196.google.com with SMTP id c22-v6so3289978pfi.2 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=BRNQCEpzbT/3rGS9MNi3tMr0qcgYPpx128Jta4fy3LHJ67HJfx0OedoItkWKVpfpkY zzl72tqByCNAOhEWT/Zxh5s4s0PcPSIlhVDDndXa+bhsNtnOOxv+sl7W2uwU6vKB6sWH Jm9RLLghUOiia4wo5yighsKuQb59DnoXk1CKookqqSLM/C8JTzM3uvrqGGwyYXlq5H4R 3oxFqqB/3tyCcAYi7hqOfzvQnQtoW58EPF9HxZsbyRJqWbhMlluEhkQNVDSYsNTDnY+i 5DjJSsKE9F4sxSn6WPr7qTzvplSWXLE+iYUwuzQIq05zZgWUl0smVBUxQSVKeqMLUCeJ tcHg== X-Gm-Message-State: APt69E3gOSqKqGfwj5NOyfZiTqSIWB9D9gDOH0CIaHr6FovC7TzvIWzM Z8mSjRZTLtb1pgQ2dBLpOMqTihVu5yE= 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 Cc: Zhouyang Jia , Jaroslav Kysela , Takashi Iwai , Bhumika Goyal , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Subject: [PATCH v2] ALSA: lx6464es: add error handling for pci_ioremap_bar 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> To: unlisted-recipients:; (no To-header on input) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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: -- 2.7.4