Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp4967827imm; Mon, 11 Jun 2018 23:47:55 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJIQ2TaVw9sIwdMiExOukbgGueChl/8jqYzJ2+Nf+EmkFMiBqmcOLiib5W4hUoDoDiCAJ/u X-Received: by 2002:a63:2a11:: with SMTP id q17-v6mr2111408pgq.60.1528786075175; Mon, 11 Jun 2018 23:47:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528786075; cv=none; d=google.com; s=arc-20160816; b=toBC3xpLg+JdHcf7m1tPAoH1czgW+D1/MhuXhlUBOKbMPuNzHGPS3xqv3BCZK+doqT ZH4PaULmVwqLk4xu5wojDFSV+CNlSkXfeT27tqeSWNwbSms8ixusQY5wlfcZpSlqCM5M dbxVVRc74vqviwwyEiQDnbbzstn/ZmdOnScydtN65LofyOzDWuEmu52Nk6YQ6FHTJzpe 34MzhJj/ENBgVPwjp94Bpjm/s1glM2zdiQyo5+MGlYpTFhnl0WAw08GGn/Qxp+bfTMdn auflxKCUejHITzUxfeVck7UoVN78hoWsugGiNWGDF4WaUWu3LUz/K3b8HQPMD613PqEJ p2Uw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:subject:cc:to:from:message-id:date :arc-authentication-results; bh=eBVIYD2ymjnpA734As29eKZKeK7LmonbAN0Z+roJ5Sw=; b=nZoxrMgeC0hWx3Fu74uMKFldkAIBXWpSNWqlAi2Wv+S3PJALMOfJMLamRslzptKB2Z E+J8lB219FUCTCMe4iZ0j/3/tecoVQnynGFG59Bpbmbaz/6+rSMgNUf/pAe0tlhPpjed 66SStSD7Su30vbkclmIqPjFsahHKFyHR2Te9ob54wp7PnEvseJUMVBpXwMti74yhkFwP +rE8GNw2iMwu3Z6EdK9J6SJymmIevI+xdzSqdMXJiyxXxtrbM2Ug+xwq5xtMdn1kKeR+ xyrHgHSOH+K/JYdNAAK1CAUbvNPCysbB6OIkbDSfrPiXZ2tBohajVmtbGRYlqYhgtVw6 FfEg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f34-v6si154006ple.165.2018.06.11.23.47.40; Mon, 11 Jun 2018 23:47:55 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933166AbeFLGp7 (ORCPT + 99 others); Tue, 12 Jun 2018 02:45:59 -0400 Received: from mx2.suse.de ([195.135.220.15]:57612 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932944AbeFLGp6 (ORCPT ); Tue, 12 Jun 2018 02:45:58 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext-too.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 2A2AEACE0; Tue, 12 Jun 2018 06:45:57 +0000 (UTC) Date: Tue, 12 Jun 2018 08:45:56 +0200 Message-ID: From: Takashi Iwai To: "Zhouyang Jia" Cc: , "Bhumika Goyal" , "Jaroslav Kysela" , Subject: Re: [PATCH] ALSA: lx6464es: add error handling for pci_ioremap_bar In-Reply-To: <1528773796-37922-1-git-send-email-jiazhouyang09@gmail.com> References: <1528773796-37922-1-git-send-email-jiazhouyang09@gmail.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/25.3 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 12 Jun 2018 05:23:14 +0200, Zhouyang Jia wrote: > > 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 This patch makes no sense, sorry. The whole lx6464es error handling there is buggy. We need to fix it more properly. And, you must have noticed a bad smell in that change before submitting this. Basically, using the same goto label for the error handling of the next step is already fishy. In this case, you'd have to unmap at the error path after this point. If you can use the same label, it means that the unmap is missing -- already something wrong. thanks, Takashi > --- > sound/pci/lx6464es/lx6464es.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/sound/pci/lx6464es/lx6464es.c b/sound/pci/lx6464es/lx6464es.c > index 9655b08..6157b6d 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 request_irq_failed; > + } > > err = request_threaded_irq(pci->irq, lx_interrupt, lx_threaded_irq, > IRQF_SHARED, KBUILD_MODNAME, chip); > -- > 2.7.4 > >