All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] media: pci: cx88: Fix missing pci_disable_device() when cx88_core_get() returns null
@ 2022-12-05  6:27 gaochao
  2022-12-05 11:32 ` kernel test robot
  2022-12-05 13:13 ` [PATCH v2] " gaochao
  0 siblings, 2 replies; 4+ messages in thread
From: gaochao @ 2022-12-05  6:27 UTC (permalink / raw)
  To: mchehab, v4l, linux-media, gaochao49

From: Gao Chao <gaochao49@huawei.com>

commit a8782f669c35 ("V4L/DVB (9796): drivers/media/video/cx88/cx88-alsa.c:
Adjust error-handling code") added fail path. However, when cx88_core_get()
returns null with chip->pci has not been setted, snd_cx88_dev_free() won't
call a valid pci_disable_device() due to invalid chip->pci. Move the
assignment of chip->pci forward to ensure snd_cx88_dev_free() can get
valid chip->pci.

Fixes: b7f355d23c34 ("V4L/DVB (3293): Added digital support for cx88 (cx88-alsa)")
Signed-off-by: Gao Chao <gaochao49@huawei.com>
---
 drivers/media/pci/cx88/cx88-alsa.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/pci/cx88/cx88-alsa.c b/drivers/media/pci/cx88/cx88-alsa.c
index 29fb1311e443..b355c168c462 100644
--- a/drivers/media/pci/cx88/cx88-alsa.c
+++ b/drivers/media/pci/cx88/cx88-alsa.c
@@ -858,6 +858,7 @@ static int snd_cx88_create(struct snd_card *card, struct pci_dev *pci,
 	if (err < 0)
 		return err;

+	chip->pci = pci;
 	pci_set_master(pci);

 	chip = card->private_data;
@@ -877,7 +878,6 @@ static int snd_cx88_create(struct snd_card *card, struct pci_dev *pci,

 	/* pci init */
 	chip->card = card;
-	chip->pci = pci;
 	chip->irq = -1;
 	spin_lock_init(&chip->reg_lock);

--
2.17.1


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

end of thread, other threads:[~2023-01-27  9:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-05  6:27 [PATCH] media: pci: cx88: Fix missing pci_disable_device() when cx88_core_get() returns null gaochao
2022-12-05 11:32 ` kernel test robot
2022-12-05 13:13 ` [PATCH v2] " gaochao
2023-01-27  9:55   ` Hans Verkuil

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.