aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pnp/manager.c
diff options
context:
space:
mode:
authorBjorn Helgaas <bjorn.helgaas@hp.com>2007-08-15 12:32:13 -0400
committerLen Brown <len.brown@intel.com>2007-08-24 01:27:24 -0400
commitb173491339b9ae7f1322241ce6228c1268513a39 (patch)
treedca8b3a7021d7957d60023e34ac96a9df5215421 /drivers/pnp/manager.c
parent4f0217e30249ac0eb13b65ef64f2aee627465da2 (diff)
PNP: remove null pointer checks
Remove some null pointer checks. Null pointers in these areas indicate programming errors, and I think it's better to oops immediately rather than return an error that is easily ignored. Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com> Acked-by: Adam Belay <abelay@novell.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/pnp/manager.c')
-rw-r--r--drivers/pnp/manager.c23
1 files changed, 0 insertions, 23 deletions
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;