aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pnp
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pnp')
-rw-r--r--drivers/pnp/core.c7
-rw-r--r--drivers/pnp/driver.c4
-rw-r--r--drivers/pnp/isapnp/core.c2
-rw-r--r--drivers/pnp/manager.c23
-rw-r--r--drivers/pnp/resource.c26
5 files changed, 2 insertions, 60 deletions
diff --git a/drivers/pnp/core.c b/drivers/pnp/core.c
index 61066fdb9e6d..d5964feb14de 100644
--- a/drivers/pnp/core.c
+++ b/drivers/pnp/core.c
@@ -52,9 +52,6 @@ int pnp_register_protocol(struct pnp_protocol *protocol)
52 int nodenum; 52 int nodenum;
53 struct list_head *pos; 53 struct list_head *pos;
54 54
55 if (!protocol)
56 return -EINVAL;
57
58 INIT_LIST_HEAD(&protocol->devices); 55 INIT_LIST_HEAD(&protocol->devices);
59 INIT_LIST_HEAD(&protocol->cards); 56 INIT_LIST_HEAD(&protocol->cards);
60 nodenum = 0; 57 nodenum = 0;
@@ -94,8 +91,6 @@ static void pnp_free_ids(struct pnp_dev *dev)
94 struct pnp_id *id; 91 struct pnp_id *id;
95 struct pnp_id *next; 92 struct pnp_id *next;
96 93
97 if (!dev)
98 return;
99 id = dev->id; 94 id = dev->id;
100 while (id) { 95 while (id) {
101 next = id->next; 96 next = id->next;
@@ -143,7 +138,7 @@ int __pnp_add_device(struct pnp_dev *dev)
143 */ 138 */
144int pnp_add_device(struct pnp_dev *dev) 139int pnp_add_device(struct pnp_dev *dev)
145{ 140{
146 if (!dev || !dev->protocol || dev->card) 141 if (dev->card)
147 return -EINVAL; 142 return -EINVAL;
148 dev->dev.parent = &dev->protocol->dev; 143 dev->dev.parent = &dev->protocol->dev;
149 sprintf(dev->dev.bus_id, "%02x:%02x", dev->protocol->number, 144 sprintf(dev->dev.bus_id, "%02x:%02x", dev->protocol->number,
diff --git a/drivers/pnp/driver.c b/drivers/pnp/driver.c
index 9be01b0433b9..2fa64a6b25c8 100644
--- a/drivers/pnp/driver.c
+++ b/drivers/pnp/driver.c
@@ -232,10 +232,6 @@ int pnp_add_id(struct pnp_id *id, struct pnp_dev *dev)
232{ 232{
233 struct pnp_id *ptr; 233 struct pnp_id *ptr;
234 234
235 if (!id)
236 return -EINVAL;
237 if (!dev)
238 return -EINVAL;
239 id->next = NULL; 235 id->next = NULL;
240 ptr = dev->id; 236 ptr = dev->id;
241 while (ptr && ptr->next) 237 while (ptr && ptr->next)
diff --git a/drivers/pnp/isapnp/core.c b/drivers/pnp/isapnp/core.c
index 1a0d33a12862..b035d60a1dcc 100644
--- a/drivers/pnp/isapnp/core.c
+++ b/drivers/pnp/isapnp/core.c
@@ -1040,7 +1040,7 @@ static int isapnp_set_resources(struct pnp_dev *dev,
1040 1040
1041static int isapnp_disable_resources(struct pnp_dev *dev) 1041static int isapnp_disable_resources(struct pnp_dev *dev)
1042{ 1042{
1043 if (!dev || !dev->active) 1043 if (!dev->active)
1044 return -EINVAL; 1044 return -EINVAL;
1045 isapnp_cfg_begin(dev->card->number, dev->number); 1045 isapnp_cfg_begin(dev->card->number, dev->number);
1046 isapnp_deactivate(dev->number); 1046 isapnp_deactivate(dev->number);
diff --git a/drivers/pnp/manager.c b/drivers/pnp/manager.c
index 329dc6c18384..0826287eef53 100644
--- a/drivers/pnp/manager.c
+++ b/drivers/pnp/manager.c
@@ -21,9 +21,6 @@ static int pnp_assign_port(struct pnp_dev *dev, struct pnp_port *rule, int idx)
21 resource_size_t *start, *end; 21 resource_size_t *start, *end;
22 unsigned long *flags; 22 unsigned long *flags;
23 23
24 if (!dev || !rule)
25 return -EINVAL;
26
27 if (idx >= PNP_MAX_PORT) { 24 if (idx >= PNP_MAX_PORT) {
28 pnp_err 25 pnp_err
29 ("More than 4 ports is incompatible with pnp specifications."); 26 ("More than 4 ports is incompatible with pnp specifications.");
@@ -66,9 +63,6 @@ static int pnp_assign_mem(struct pnp_dev *dev, struct pnp_mem *rule, int idx)
66 resource_size_t *start, *end; 63 resource_size_t *start, *end;
67 unsigned long *flags; 64 unsigned long *flags;
68 65
69 if (!dev || !rule)
70 return -EINVAL;
71
72 if (idx >= PNP_MAX_MEM) { 66 if (idx >= PNP_MAX_MEM) {
73 pnp_err 67 pnp_err
74 ("More than 8 mems is incompatible with pnp specifications."); 68 ("More than 8 mems is incompatible with pnp specifications.");
@@ -127,9 +121,6 @@ static int pnp_assign_irq(struct pnp_dev *dev, struct pnp_irq *rule, int idx)
127 5, 10, 11, 12, 9, 14, 15, 7, 3, 4, 13, 0, 1, 6, 8, 2 121 5, 10, 11, 12, 9, 14, 15, 7, 3, 4, 13, 0, 1, 6, 8, 2
128 }; 122 };
129 123
130 if (!dev || !rule)
131 return -EINVAL;
132
133 if (idx >= PNP_MAX_IRQ) { 124 if (idx >= PNP_MAX_IRQ) {
134 pnp_err 125 pnp_err
135 ("More than 2 irqs is incompatible with pnp specifications."); 126 ("More than 2 irqs is incompatible with pnp specifications.");
@@ -181,9 +172,6 @@ static int pnp_assign_dma(struct pnp_dev *dev, struct pnp_dma *rule, int idx)
181 1, 3, 5, 6, 7, 0, 2, 4 172 1, 3, 5, 6, 7, 0, 2, 4
182 }; 173 };
183 174
184 if (!dev || !rule)
185 return -EINVAL;
186
187 if (idx >= PNP_MAX_DMA) { 175 if (idx >= PNP_MAX_DMA) {
188 pnp_err 176 pnp_err
189 ("More than 2 dmas is incompatible with pnp specifications."); 177 ("More than 2 dmas is incompatible with pnp specifications.");
@@ -410,8 +398,6 @@ int pnp_manual_config_dev(struct pnp_dev *dev, struct pnp_resource_table *res,
410 int i; 398 int i;
411 struct pnp_resource_table *bak; 399 struct pnp_resource_table *bak;
412 400
413 if (!dev || !res)
414 return -EINVAL;
415 if (!pnp_can_configure(dev)) 401 if (!pnp_can_configure(dev))
416 return -ENODEV; 402 return -ENODEV;
417 bak = pnp_alloc(sizeof(struct pnp_resource_table)); 403 bak = pnp_alloc(sizeof(struct pnp_resource_table));
@@ -460,9 +446,6 @@ int pnp_auto_config_dev(struct pnp_dev *dev)
460 struct pnp_option *dep; 446 struct pnp_option *dep;
461 int i = 1; 447 int i = 1;
462 448
463 if (!dev)
464 return -EINVAL;
465
466 if (!pnp_can_configure(dev)) { 449 if (!pnp_can_configure(dev)) {
467 pnp_dbg("Device %s does not support resource configuration.", 450 pnp_dbg("Device %s does not support resource configuration.",
468 dev->dev.bus_id); 451 dev->dev.bus_id);
@@ -541,8 +524,6 @@ int pnp_activate_dev(struct pnp_dev *dev)
541{ 524{
542 int error; 525 int error;
543 526
544 if (!dev)
545 return -EINVAL;
546 if (dev->active) 527 if (dev->active)
547 return 0; /* the device is already active */ 528 return 0; /* the device is already active */
548 529
@@ -568,8 +549,6 @@ int pnp_disable_dev(struct pnp_dev *dev)
568{ 549{
569 int error; 550 int error;
570 551
571 if (!dev)
572 return -EINVAL;
573 if (!dev->active) 552 if (!dev->active)
574 return 0; /* the device is already disabled */ 553 return 0; /* the device is already disabled */
575 554
@@ -596,8 +575,6 @@ int pnp_disable_dev(struct pnp_dev *dev)
596void pnp_resource_change(struct resource *resource, resource_size_t start, 575void pnp_resource_change(struct resource *resource, resource_size_t start,
597 resource_size_t size) 576 resource_size_t size)
598{ 577{
599 if (resource == NULL)
600 return;
601 resource->flags &= ~(IORESOURCE_AUTO | IORESOURCE_UNSET); 578 resource->flags &= ~(IORESOURCE_AUTO | IORESOURCE_UNSET);
602 resource->start = start; 579 resource->start = start;
603 resource->end = start + size - 1; 580 resource->end = start + size - 1;
diff --git a/drivers/pnp/resource.c b/drivers/pnp/resource.c
index ea6ec14a0559..ef1286900db3 100644
--- a/drivers/pnp/resource.c
+++ b/drivers/pnp/resource.c
@@ -47,9 +47,6 @@ struct pnp_option *pnp_register_independent_option(struct pnp_dev *dev)
47{ 47{
48 struct pnp_option *option; 48 struct pnp_option *option;
49 49
50 if (!dev)
51 return NULL;
52
53 option = pnp_build_option(PNP_RES_PRIORITY_PREFERRED); 50 option = pnp_build_option(PNP_RES_PRIORITY_PREFERRED);
54 51
55 /* this should never happen but if it does we'll try to continue */ 52 /* this should never happen but if it does we'll try to continue */
@@ -64,9 +61,6 @@ struct pnp_option *pnp_register_dependent_option(struct pnp_dev *dev,
64{ 61{
65 struct pnp_option *option; 62 struct pnp_option *option;
66 63
67 if (!dev)
68 return NULL;
69
70 option = pnp_build_option(priority); 64 option = pnp_build_option(priority);
71 65
72 if (dev->dependent) { 66 if (dev->dependent) {
@@ -83,11 +77,6 @@ int pnp_register_irq_resource(struct pnp_option *option, struct pnp_irq *data)
83{ 77{
84 struct pnp_irq *ptr; 78 struct pnp_irq *ptr;
85 79
86 if (!option)
87 return -EINVAL;
88 if (!data)
89 return -EINVAL;
90
91 ptr = option->irq; 80 ptr = option->irq;
92 while (ptr && ptr->next) 81 while (ptr && ptr->next)
93 ptr = ptr->next; 82 ptr = ptr->next;
@@ -112,11 +101,6 @@ int pnp_register_dma_resource(struct pnp_option *option, struct pnp_dma *data)
112{ 101{
113 struct pnp_dma *ptr; 102 struct pnp_dma *ptr;
114 103
115 if (!option)
116 return -EINVAL;
117 if (!data)
118 return -EINVAL;
119
120 ptr = option->dma; 104 ptr = option->dma;
121 while (ptr && ptr->next) 105 while (ptr && ptr->next)
122 ptr = ptr->next; 106 ptr = ptr->next;
@@ -132,11 +116,6 @@ int pnp_register_port_resource(struct pnp_option *option, struct pnp_port *data)
132{ 116{
133 struct pnp_port *ptr; 117 struct pnp_port *ptr;
134 118
135 if (!option)
136 return -EINVAL;
137 if (!data)
138 return -EINVAL;
139
140 ptr = option->port; 119 ptr = option->port;
141 while (ptr && ptr->next) 120 while (ptr && ptr->next)
142 ptr = ptr->next; 121 ptr = ptr->next;
@@ -152,11 +131,6 @@ int pnp_register_mem_resource(struct pnp_option *option, struct pnp_mem *data)
152{ 131{
153 struct pnp_mem *ptr; 132 struct pnp_mem *ptr;
154 133
155 if (!option)
156 return -EINVAL;
157 if (!data)
158 return -EINVAL;
159
160 ptr = option->mem; 134 ptr = option->mem;
161 while (ptr && ptr->next) 135 while (ptr && ptr->next)
162 ptr = ptr->next; 136 ptr = ptr->next;