public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ALSA: lx6464es: add error handling for pci_ioremap_bar
@ 2018-06-12  3:23 Zhouyang Jia
  2018-06-12  6:45 ` Takashi Iwai
  2018-06-14 13:51 ` [PATCH v2] " Zhouyang Jia
  0 siblings, 2 replies; 4+ messages in thread
From: Zhouyang Jia @ 2018-06-12  3:23 UTC (permalink / raw)
  Cc: Zhouyang Jia, Jaroslav Kysela, Takashi Iwai, Bhumika Goyal,
	alsa-devel, linux-kernel

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>
---
 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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-06-14 16:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-12  3:23 [PATCH] ALSA: lx6464es: add error handling for pci_ioremap_bar Zhouyang Jia
2018-06-12  6:45 ` Takashi Iwai
2018-06-14 13:51 ` [PATCH v2] " Zhouyang Jia
2018-06-14 16:01   ` Takashi Iwai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox