aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/bt8xx/bttv-if.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/bt8xx/bttv-if.c')
-rw-r--r--drivers/media/video/bt8xx/bttv-if.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/drivers/media/video/bt8xx/bttv-if.c b/drivers/media/video/bt8xx/bttv-if.c
index ecf07988cd33..a6a540dc9e4b 100644
--- a/drivers/media/video/bt8xx/bttv-if.c
+++ b/drivers/media/video/bt8xx/bttv-if.c
@@ -47,7 +47,10 @@ struct pci_dev* bttv_get_pcidev(unsigned int card)
47{ 47{
48 if (card >= bttv_num) 48 if (card >= bttv_num)
49 return NULL; 49 return NULL;
50 return bttvs[card].c.pci; 50 if (!bttvs[card])
51 return NULL;
52
53 return bttvs[card]->c.pci;
51} 54}
52 55
53 56
@@ -59,7 +62,10 @@ int bttv_gpio_enable(unsigned int card, unsigned long mask, unsigned long data)
59 return -EINVAL; 62 return -EINVAL;
60 } 63 }
61 64
62 btv = &bttvs[card]; 65 btv = bttvs[card];
66 if (!btv)
67 return -ENODEV;
68
63 gpio_inout(mask,data); 69 gpio_inout(mask,data);
64 if (bttv_gpio) 70 if (bttv_gpio)
65 bttv_gpio_tracking(btv,"extern enable"); 71 bttv_gpio_tracking(btv,"extern enable");
@@ -74,7 +80,9 @@ int bttv_read_gpio(unsigned int card, unsigned long *data)
74 return -EINVAL; 80 return -EINVAL;
75 } 81 }
76 82
77 btv = &bttvs[card]; 83 btv = bttvs[card];
84 if (!btv)
85 return -ENODEV;
78 86
79 if(btv->shutdown) { 87 if(btv->shutdown) {
80 return -ENODEV; 88 return -ENODEV;
@@ -94,7 +102,9 @@ int bttv_write_gpio(unsigned int card, unsigned long mask, unsigned long data)
94 return -EINVAL; 102 return -EINVAL;
95 } 103 }
96 104
97 btv = &bttvs[card]; 105 btv = bttvs[card];
106 if (!btv)
107 return -ENODEV;
98 108
99/* prior setting BT848_GPIO_REG_INP is (probably) not needed 109/* prior setting BT848_GPIO_REG_INP is (probably) not needed
100 because direct input is set on init */ 110 because direct input is set on init */