aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorBjorn Helgaas <bjorn.helgaas@hp.com>2007-10-17 02:31:09 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-17 11:43:04 -0400
commit402b310cb6e523779149139b20f46899a890e963 (patch)
treeac97df1b8b92cfb41cac08bd3ebfb177775570dd /drivers
parent9cd8047b463f213c294f756119ac353312e7a152 (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> Cc: Adam Belay <ambx1@neo.rr.com> Cc: Len Brown <lenb@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/pnp/card.c15
1 files changed, 0 insertions, 15 deletions
diff --git a/drivers/pnp/card.c b/drivers/pnp/card.c
index 6c0440c20e31..fae28913f459 100644
--- a/drivers/pnp/card.c
+++ b/drivers/pnp/card.c
@@ -104,10 +104,6 @@ int pnp_add_card_id(struct pnp_id *id, struct pnp_card *card)
104{ 104{
105 struct pnp_id *ptr; 105 struct pnp_id *ptr;
106 106
107 if (!id)
108 return -EINVAL;
109 if (!card)
110 return -EINVAL;
111 id->next = NULL; 107 id->next = NULL;
112 ptr = card->id; 108 ptr = card->id;
113 while (ptr && ptr->next) 109 while (ptr && ptr->next)
@@ -124,8 +120,6 @@ static void pnp_free_card_ids(struct pnp_card *card)
124 struct pnp_id *id; 120 struct pnp_id *id;
125 struct pnp_id *next; 121 struct pnp_id *next;
126 122
127 if (!card)
128 return;
129 id = card->id; 123 id = card->id;
130 while (id) { 124 while (id) {
131 next = id->next; 125 next = id->next;
@@ -197,9 +191,6 @@ int pnp_add_card(struct pnp_card *card)
197 int error; 191 int error;
198 struct list_head *pos, *temp; 192 struct list_head *pos, *temp;
199 193
200 if (!card || !card->protocol)
201 return -EINVAL;
202
203 sprintf(card->dev.bus_id, "%02x:%02x", card->protocol->number, 194 sprintf(card->dev.bus_id, "%02x:%02x", card->protocol->number,
204 card->number); 195 card->number);
205 card->dev.parent = &card->protocol->dev; 196 card->dev.parent = &card->protocol->dev;
@@ -243,8 +234,6 @@ void pnp_remove_card(struct pnp_card *card)
243{ 234{
244 struct list_head *pos, *temp; 235 struct list_head *pos, *temp;
245 236
246 if (!card)
247 return;
248 device_unregister(&card->dev); 237 device_unregister(&card->dev);
249 spin_lock(&pnp_lock); 238 spin_lock(&pnp_lock);
250 list_del(&card->global_list); 239 list_del(&card->global_list);
@@ -263,8 +252,6 @@ void pnp_remove_card(struct pnp_card *card)
263 */ 252 */
264int pnp_add_card_device(struct pnp_card *card, struct pnp_dev *dev) 253int pnp_add_card_device(struct pnp_card *card, struct pnp_dev *dev)
265{ 254{
266 if (!card || !dev || !dev->protocol)
267 return -EINVAL;
268 dev->dev.parent = &card->dev; 255 dev->dev.parent = &card->dev;
269 dev->card_link = NULL; 256 dev->card_link = NULL;
270 snprintf(dev->dev.bus_id, BUS_ID_SIZE, "%02x:%02x.%02x", 257 snprintf(dev->dev.bus_id, BUS_ID_SIZE, "%02x:%02x.%02x",
@@ -348,8 +335,6 @@ void pnp_release_card_device(struct pnp_dev *dev)
348{ 335{
349 struct pnp_card_driver *drv = dev->card_link->driver; 336 struct pnp_card_driver *drv = dev->card_link->driver;
350 337
351 if (!drv)
352 return;
353 drv->link.remove = &card_remove; 338 drv->link.remove = &card_remove;
354 device_release_driver(&dev->dev); 339 device_release_driver(&dev->dev);
355 drv->link.remove = &card_remove_first; 340 drv->link.remove = &card_remove_first;