From: Takashi Iwai <tiwai@suse.de>
To: "Zhouyang Jia" <jiazhouyang09@gmail.com>
Cc: <alsa-devel@alsa-project.org>,
"Bhumika Goyal" <bhumirks@gmail.com>,
"Jaroslav Kysela" <perex@perex.cz>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] ALSA: lx6464es: add error handling for pci_ioremap_bar
Date: Tue, 12 Jun 2018 08:45:56 +0200 [thread overview]
Message-ID: <s5hsh5szemz.wl-tiwai@suse.de> (raw)
In-Reply-To: <1528773796-37922-1-git-send-email-jiazhouyang09@gmail.com>
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 <jiazhouyang09@gmail.com>
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
>
>
next prev parent reply other threads:[~2018-06-12 6:46 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-12 3:23 Zhouyang Jia
2018-06-12 6:45 ` Takashi Iwai [this message]
2018-06-14 13:51 ` [PATCH v2] " Zhouyang Jia
2018-06-14 16:01 ` Takashi Iwai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=s5hsh5szemz.wl-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=alsa-devel@alsa-project.org \
--cc=bhumirks@gmail.com \
--cc=jiazhouyang09@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=perex@perex.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®