aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesper Juhl <jesper.juhl@gmail.com>2005-11-07 04:01:32 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2005-11-07 10:54:05 -0500
commit6044ec8882c726e325017bd948aa0cd94ad33abc (patch)
tree3bfc5dc93434e8ad556540f6689abcd2699aa45d
parent2ea7533060e361810c21b2f5ee02151c4dfb85d8 (diff)
[PATCH] kfree cleanup: misc remaining drivers
This is the remaining misc drivers/ part of the big kfree cleanup patch. Remove pointless checks for NULL prior to calling kfree() in misc files in drivers/. Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com> Acked-by: Aristeu Sergio Rozanski Filho <aris@cathedrallabs.org> Acked-by: Roland Dreier <rolandd@cisco.com> Acked-by: Pierre Ossman <drzeus@drzeus.cx> Acked-by: Jean Delvare <khali@linux-fr.org> Acked-by: Greg Kroah-Hartman <gregkh@suse.de> Acked-by: Len Brown <len.brown@intel.com> Acked-by: "Antonino A. Daplas" <adaplas@gmail.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--drivers/acpi/container.c6
-rw-r--r--drivers/acpi/scan.c6
-rw-r--r--drivers/acpi/video.c12
-rw-r--r--drivers/block/DAC960.c31
-rw-r--r--drivers/block/cciss.c12
-rw-r--r--drivers/fc4/fc.c5
-rw-r--r--drivers/hwmon/w83781d.c6
-rw-r--r--drivers/i2c/busses/i2c-amd756-s4882.c6
-rw-r--r--drivers/ide/ide-cd.c18
-rw-r--r--drivers/ide/ide-probe.c6
-rw-r--r--drivers/ide/ide-taskfile.c6
-rw-r--r--drivers/ide/ide.c3
-rw-r--r--drivers/infiniband/core/mad.c6
-rw-r--r--drivers/input/misc/uinput.c10
-rw-r--r--drivers/macintosh/adbhid.c3
-rw-r--r--drivers/mmc/wbsd.c3
-rw-r--r--drivers/parport/probe.c21
-rw-r--r--drivers/parport/share.c19
-rw-r--r--drivers/pci/hotplug/cpqphp_pci.c15
-rw-r--r--drivers/pcmcia/cistpl.c12
-rw-r--r--drivers/pcmcia/cs.c6
-rw-r--r--drivers/sbus/char/envctrl.c13
-rw-r--r--drivers/video/i810/i810_main.c3
-rw-r--r--drivers/w1/w1_ds2433.c6
24 files changed, 83 insertions, 151 deletions
diff --git a/drivers/acpi/container.c b/drivers/acpi/container.c
index 10dd695a1dd9..27ec12c1fab0 100644
--- a/drivers/acpi/container.c
+++ b/drivers/acpi/container.c
@@ -118,11 +118,9 @@ static int acpi_container_remove(struct acpi_device *device, int type)
118{ 118{
119 acpi_status status = AE_OK; 119 acpi_status status = AE_OK;
120 struct acpi_container *pc = NULL; 120 struct acpi_container *pc = NULL;
121 pc = (struct acpi_container *)acpi_driver_data(device);
122
123 if (pc)
124 kfree(pc);
125 121
122 pc = (struct acpi_container *)acpi_driver_data(device);
123 kfree(pc);
126 return status; 124 return status;
127} 125}
128 126
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index c6db591479de..23e2c6968a11 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -28,8 +28,7 @@ static int acpi_bus_trim(struct acpi_device *start, int rmdevice);
28static void acpi_device_release(struct kobject *kobj) 28static void acpi_device_release(struct kobject *kobj)
29{ 29{
30 struct acpi_device *dev = container_of(kobj, struct acpi_device, kobj); 30 struct acpi_device *dev = container_of(kobj, struct acpi_device, kobj);
31 if (dev->pnp.cid_list) 31 kfree(dev->pnp.cid_list);
32 kfree(dev->pnp.cid_list);
33 kfree(dev); 32 kfree(dev);
34} 33}
35 34
@@ -1117,8 +1116,7 @@ acpi_add_single_object(struct acpi_device **child,
1117 if (!result) 1116 if (!result)
1118 *child = device; 1117 *child = device;
1119 else { 1118 else {
1120 if (device->pnp.cid_list) 1119 kfree(device->pnp.cid_list);
1121 kfree(device->pnp.cid_list);
1122 kfree(device); 1120 kfree(device);
1123 } 1121 }
1124 1122
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
index e383d6109ae1..f051b151580d 100644
--- a/drivers/acpi/video.c
+++ b/drivers/acpi/video.c
@@ -334,8 +334,7 @@ acpi_video_device_lcd_query_levels(struct acpi_video_device *device,
334 return_VALUE(0); 334 return_VALUE(0);
335 335
336 err: 336 err:
337 if (buffer.pointer) 337 kfree(buffer.pointer);
338 kfree(buffer.pointer);
339 338
340 return_VALUE(status); 339 return_VALUE(status);
341} 340}
@@ -1488,8 +1487,7 @@ static int acpi_video_device_enumerate(struct acpi_video_bus *video)
1488 } 1487 }
1489 active_device_list[count].value.int_val = ACPI_VIDEO_HEAD_END; 1488 active_device_list[count].value.int_val = ACPI_VIDEO_HEAD_END;
1490 1489
1491 if (video->attached_array) 1490 kfree(video->attached_array);
1492 kfree(video->attached_array);
1493 1491
1494 video->attached_array = active_device_list; 1492 video->attached_array = active_device_list;
1495 video->attached_count = count; 1493 video->attached_count = count;
@@ -1645,8 +1643,7 @@ static int acpi_video_bus_put_devices(struct acpi_video_bus *video)
1645 printk(KERN_WARNING PREFIX 1643 printk(KERN_WARNING PREFIX
1646 "hhuuhhuu bug in acpi video driver.\n"); 1644 "hhuuhhuu bug in acpi video driver.\n");
1647 1645
1648 if (data->brightness) 1646 kfree(data->brightness);
1649 kfree(data->brightness);
1650 1647
1651 kfree(data); 1648 kfree(data);
1652 } 1649 }
@@ -1831,8 +1828,7 @@ static int acpi_video_bus_remove(struct acpi_device *device, int type)
1831 acpi_video_bus_put_devices(video); 1828 acpi_video_bus_put_devices(video);
1832 acpi_video_bus_remove_fs(device); 1829 acpi_video_bus_remove_fs(device);
1833 1830
1834 if (video->attached_array) 1831 kfree(video->attached_array);
1835 kfree(video->attached_array);
1836 kfree(video); 1832 kfree(video);
1837 1833
1838 return_VALUE(0); 1834 return_VALUE(0);
diff --git a/drivers/block/DAC960.c b/drivers/block/DAC960.c
index 3760edfdc65c..70eaa5c7ac08 100644
--- a/drivers/block/DAC960.c
+++ b/drivers/block/DAC960.c
@@ -417,14 +417,12 @@ static void DAC960_DestroyAuxiliaryStructures(DAC960_Controller_T *Controller)
417 * Remember the beginning of the group, but don't free it 417 * Remember the beginning of the group, but don't free it
418 * until we've reached the beginning of the next group. 418 * until we've reached the beginning of the next group.
419 */ 419 */
420 if (CommandGroup != NULL) 420 kfree(CommandGroup);
421 kfree(CommandGroup); 421 CommandGroup = Command;
422 CommandGroup = Command;
423 } 422 }
424 Controller->Commands[i] = NULL; 423 Controller->Commands[i] = NULL;
425 } 424 }
426 if (CommandGroup != NULL) 425 kfree(CommandGroup);
427 kfree(CommandGroup);
428 426
429 if (Controller->CombinedStatusBuffer != NULL) 427 if (Controller->CombinedStatusBuffer != NULL)
430 { 428 {
@@ -435,30 +433,23 @@ static void DAC960_DestroyAuxiliaryStructures(DAC960_Controller_T *Controller)
435 433
436 if (ScatterGatherPool != NULL) 434 if (ScatterGatherPool != NULL)
437 pci_pool_destroy(ScatterGatherPool); 435 pci_pool_destroy(ScatterGatherPool);
438 if (Controller->FirmwareType == DAC960_V1_Controller) return; 436 if (Controller->FirmwareType == DAC960_V1_Controller)
437 return;
439 438
440 if (RequestSensePool != NULL) 439 if (RequestSensePool != NULL)
441 pci_pool_destroy(RequestSensePool); 440 pci_pool_destroy(RequestSensePool);
442 441
443 for (i = 0; i < DAC960_MaxLogicalDrives; i++) 442 for (i = 0; i < DAC960_MaxLogicalDrives; i++) {
444 if (Controller->V2.LogicalDeviceInformation[i] != NULL)
445 {
446 kfree(Controller->V2.LogicalDeviceInformation[i]); 443 kfree(Controller->V2.LogicalDeviceInformation[i]);
447 Controller->V2.LogicalDeviceInformation[i] = NULL; 444 Controller->V2.LogicalDeviceInformation[i] = NULL;
448 } 445 }
449 446
450 for (i = 0; i < DAC960_V2_MaxPhysicalDevices; i++) 447 for (i = 0; i < DAC960_V2_MaxPhysicalDevices; i++)
451 { 448 {
452 if (Controller->V2.PhysicalDeviceInformation[i] != NULL) 449 kfree(Controller->V2.PhysicalDeviceInformation[i]);
453 { 450 Controller->V2.PhysicalDeviceInformation[i] = NULL;
454 kfree(Controller->V2.PhysicalDeviceInformation[i]); 451 kfree(Controller->V2.InquiryUnitSerialNumber[i]);
455 Controller->V2.PhysicalDeviceInformation[i] = NULL; 452 Controller->V2.InquiryUnitSerialNumber[i] = NULL;
456 }
457 if (Controller->V2.InquiryUnitSerialNumber[i] != NULL)
458 {
459 kfree(Controller->V2.InquiryUnitSerialNumber[i]);
460 Controller->V2.InquiryUnitSerialNumber[i] = NULL;
461 }
462 } 453 }
463} 454}
464 455
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
index 486b6e1c7dfb..a97c80b57737 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -1096,14 +1096,11 @@ static int cciss_ioctl(struct inode *inode, struct file *filep,
1096cleanup1: 1096cleanup1:
1097 if (buff) { 1097 if (buff) {
1098 for(i=0; i<sg_used; i++) 1098 for(i=0; i<sg_used; i++)
1099 if(buff[i] != NULL) 1099 kfree(buff[i]);
1100 kfree(buff[i]);
1101 kfree(buff); 1100 kfree(buff);
1102 } 1101 }
1103 if (buff_size) 1102 kfree(buff_size);
1104 kfree(buff_size); 1103 kfree(ioc);
1105 if (ioc)
1106 kfree(ioc);
1107 return(status); 1104 return(status);
1108 } 1105 }
1109 default: 1106 default:
@@ -3034,8 +3031,7 @@ static int __devinit cciss_init_one(struct pci_dev *pdev,
3034 return(1); 3031 return(1);
3035 3032
3036clean4: 3033clean4:
3037 if(hba[i]->cmd_pool_bits) 3034 kfree(hba[i]->cmd_pool_bits);
3038 kfree(hba[i]->cmd_pool_bits);
3039 if(hba[i]->cmd_pool) 3035 if(hba[i]->cmd_pool)
3040 pci_free_consistent(hba[i]->pdev, 3036 pci_free_consistent(hba[i]->pdev,
3041 NR_CMDS * sizeof(CommandList_struct), 3037 NR_CMDS * sizeof(CommandList_struct),
diff --git a/drivers/fc4/fc.c b/drivers/fc4/fc.c
index e375995a2e9b..5c8943509cc1 100644
--- a/drivers/fc4/fc.c
+++ b/drivers/fc4/fc.c
@@ -554,8 +554,8 @@ int fcp_initialize(fc_channel *fcchain, int count)
554 l->logi = kzalloc (count * 3 * sizeof(logi), GFP_KERNEL); 554 l->logi = kzalloc (count * 3 * sizeof(logi), GFP_KERNEL);
555 l->fcmds = kzalloc (count * sizeof(fcp_cmnd), GFP_KERNEL); 555 l->fcmds = kzalloc (count * sizeof(fcp_cmnd), GFP_KERNEL);
556 if (!l->logi || !l->fcmds) { 556 if (!l->logi || !l->fcmds) {
557 if (l->logi) kfree (l->logi); 557 kfree (l->logi);
558 if (l->fcmds) kfree (l->fcmds); 558 kfree (l->fcmds);
559 kfree (l); 559 kfree (l);
560 printk ("FC: Cannot allocate DMA memory for initialization\n"); 560 printk ("FC: Cannot allocate DMA memory for initialization\n");
561 return -ENOMEM; 561 return -ENOMEM;
@@ -674,7 +674,6 @@ int fcp_forceoffline(fc_channel *fcchain, int count)
674 atomic_set (&l.todo, count); 674 atomic_set (&l.todo, count);
675 l.fcmds = kzalloc (count * sizeof(fcp_cmnd), GFP_KERNEL); 675 l.fcmds = kzalloc (count * sizeof(fcp_cmnd), GFP_KERNEL);
676 if (!l.fcmds) { 676 if (!l.fcmds) {
677 kfree (l.fcmds);
678 printk ("FC: Cannot allocate memory for forcing offline\n"); 677 printk ("FC: Cannot allocate memory for forcing offline\n");
679 return -ENOMEM; 678 return -ENOMEM;
680 } 679 }
diff --git a/drivers/hwmon/w83781d.c b/drivers/hwmon/w83781d.c
index 9265f32122fa..ffdb3a03e2b5 100644
--- a/drivers/hwmon/w83781d.c
+++ b/drivers/hwmon/w83781d.c
@@ -976,11 +976,9 @@ w83781d_detect_subclients(struct i2c_adapter *adapter, int address, int kind,
976ERROR_SC_3: 976ERROR_SC_3:
977 i2c_detach_client(data->lm75[0]); 977 i2c_detach_client(data->lm75[0]);
978ERROR_SC_2: 978ERROR_SC_2:
979 if (data->lm75[1]) 979 kfree(data->lm75[1]);
980 kfree(data->lm75[1]);
981ERROR_SC_1: 980ERROR_SC_1:
982 if (data->lm75[0]) 981 kfree(data->lm75[0]);
983 kfree(data->lm75[0]);
984ERROR_SC_0: 982ERROR_SC_0:
985 return err; 983 return err;
986} 984}
diff --git a/drivers/i2c/busses/i2c-amd756-s4882.c b/drivers/i2c/busses/i2c-amd756-s4882.c
index f51ab652300a..56c7d987590f 100644
--- a/drivers/i2c/busses/i2c-amd756-s4882.c
+++ b/drivers/i2c/busses/i2c-amd756-s4882.c
@@ -245,10 +245,8 @@ static void __exit amd756_s4882_exit(void)
245 kfree(s4882_adapter); 245 kfree(s4882_adapter);
246 s4882_adapter = NULL; 246 s4882_adapter = NULL;
247 } 247 }
248 if (s4882_algo) { 248 kfree(s4882_algo);
249 kfree(s4882_algo); 249 s4882_algo = NULL;
250 s4882_algo = NULL;
251 }
252 250
253 /* Restore physical bus */ 251 /* Restore physical bus */
254 if (i2c_add_adapter(&amd756_smbus)) 252 if (i2c_add_adapter(&amd756_smbus))
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 74d2ab0d901e..c2f47923d174 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -3292,12 +3292,9 @@ static void ide_cd_release(struct kref *kref)
3292 ide_drive_t *drive = info->drive; 3292 ide_drive_t *drive = info->drive;
3293 struct gendisk *g = info->disk; 3293 struct gendisk *g = info->disk;
3294 3294
3295 if (info->buffer != NULL) 3295 kfree(info->buffer);
3296 kfree(info->buffer); 3296 kfree(info->toc);
3297 if (info->toc != NULL) 3297 kfree(info->changer_info);
3298 kfree(info->toc);
3299 if (info->changer_info != NULL)
3300 kfree(info->changer_info);
3301 if (devinfo->handle == drive && unregister_cdrom(devinfo)) 3298 if (devinfo->handle == drive && unregister_cdrom(devinfo))
3302 printk(KERN_ERR "%s: %s failed to unregister device from the cdrom " 3299 printk(KERN_ERR "%s: %s failed to unregister device from the cdrom "
3303 "driver.\n", __FUNCTION__, drive->name); 3300 "driver.\n", __FUNCTION__, drive->name);
@@ -3487,12 +3484,9 @@ static int ide_cd_probe(struct device *dev)
3487 if (ide_cdrom_setup(drive)) { 3484 if (ide_cdrom_setup(drive)) {
3488 struct cdrom_device_info *devinfo = &info->devinfo; 3485 struct cdrom_device_info *devinfo = &info->devinfo;
3489 ide_unregister_subdriver(drive, &ide_cdrom_driver); 3486 ide_unregister_subdriver(drive, &ide_cdrom_driver);
3490 if (info->buffer != NULL) 3487 kfree(info->buffer);
3491 kfree(info->buffer); 3488 kfree(info->toc);
3492 if (info->toc != NULL) 3489 kfree(info->changer_info);
3493 kfree(info->toc);
3494 if (info->changer_info != NULL)
3495 kfree(info->changer_info);
3496 if (devinfo->handle == drive && unregister_cdrom(devinfo)) 3490 if (devinfo->handle == drive && unregister_cdrom(devinfo))
3497 printk (KERN_ERR "%s: ide_cdrom_cleanup failed to unregister device from the cdrom driver.\n", drive->name); 3491 printk (KERN_ERR "%s: ide_cdrom_cleanup failed to unregister device from the cdrom driver.\n", drive->name);
3498 kfree(info); 3492 kfree(info);
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c
index e6695e5df5bd..02167a5b751d 100644
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -1315,10 +1315,8 @@ static void drive_release_dev (struct device *dev)
1315 drive->devfs_name[0] = '\0'; 1315 drive->devfs_name[0] = '\0';
1316 } 1316 }
1317 ide_remove_drive_from_hwgroup(drive); 1317 ide_remove_drive_from_hwgroup(drive);
1318 if (drive->id != NULL) { 1318 kfree(drive->id);
1319 kfree(drive->id); 1319 drive->id = NULL;
1320 drive->id = NULL;
1321 }
1322 drive->present = 0; 1320 drive->present = 0;
1323 /* Messed up locking ... */ 1321 /* Messed up locking ... */
1324 spin_unlock_irq(&ide_lock); 1322 spin_unlock_irq(&ide_lock);
diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c
index 9c3b4f615621..7ec18fa3b5ff 100644
--- a/drivers/ide/ide-taskfile.c
+++ b/drivers/ide/ide-taskfile.c
@@ -646,10 +646,8 @@ int ide_taskfile_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg)
646 } 646 }
647abort: 647abort:
648 kfree(req_task); 648 kfree(req_task);
649 if (outbuf != NULL) 649 kfree(outbuf);
650 kfree(outbuf); 650 kfree(inbuf);
651 if (inbuf != NULL)
652 kfree(inbuf);
653 651
654// printk("IDE Taskfile ioctl ended. rc = %i\n", err); 652// printk("IDE Taskfile ioctl ended. rc = %i\n", err);
655 653
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c
index 1bbf67882ae5..9fe19808d815 100644
--- a/drivers/ide/ide.c
+++ b/drivers/ide/ide.c
@@ -888,8 +888,7 @@ static int __ide_add_setting(ide_drive_t *drive, const char *name, int rw, int r
888 return 0; 888 return 0;
889abort: 889abort:
890 up(&ide_setting_sem); 890 up(&ide_setting_sem);
891 if (setting) 891 kfree(setting);
892 kfree(setting);
893 return -1; 892 return -1;
894} 893}
895 894
diff --git a/drivers/infiniband/core/mad.c b/drivers/infiniband/core/mad.c
index 3d8175e5f054..41d6b4017acb 100644
--- a/drivers/infiniband/core/mad.c
+++ b/drivers/infiniband/core/mad.c
@@ -508,8 +508,7 @@ static void unregister_mad_agent(struct ib_mad_agent_private *mad_agent_priv)
508 wait_event(mad_agent_priv->wait, 508 wait_event(mad_agent_priv->wait,
509 !atomic_read(&mad_agent_priv->refcount)); 509 !atomic_read(&mad_agent_priv->refcount));
510 510
511 if (mad_agent_priv->reg_req) 511 kfree(mad_agent_priv->reg_req);
512 kfree(mad_agent_priv->reg_req);
513 ib_dereg_mr(mad_agent_priv->agent.mr); 512 ib_dereg_mr(mad_agent_priv->agent.mr);
514 kfree(mad_agent_priv); 513 kfree(mad_agent_priv);
515} 514}
@@ -2500,8 +2499,7 @@ error:
2500static void destroy_mad_qp(struct ib_mad_qp_info *qp_info) 2499static void destroy_mad_qp(struct ib_mad_qp_info *qp_info)
2501{ 2500{
2502 ib_destroy_qp(qp_info->qp); 2501 ib_destroy_qp(qp_info->qp);
2503 if (qp_info->snoop_table) 2502 kfree(qp_info->snoop_table);
2504 kfree(qp_info->snoop_table);
2505} 2503}
2506 2504
2507/* 2505/*
diff --git a/drivers/input/misc/uinput.c b/drivers/input/misc/uinput.c
index 4015a91f4b6e..948c1cc01bc9 100644
--- a/drivers/input/misc/uinput.c
+++ b/drivers/input/misc/uinput.c
@@ -271,8 +271,7 @@ static int uinput_alloc_device(struct file *file, const char __user *buffer, siz
271 goto exit; 271 goto exit;
272 } 272 }
273 273
274 if (dev->name) 274 kfree(dev->name);
275 kfree(dev->name);
276 275
277 size = strnlen(user_dev->name, UINPUT_MAX_NAME_SIZE) + 1; 276 size = strnlen(user_dev->name, UINPUT_MAX_NAME_SIZE) + 1;
278 dev->name = name = kmalloc(size, GFP_KERNEL); 277 dev->name = name = kmalloc(size, GFP_KERNEL);
@@ -372,11 +371,8 @@ static int uinput_burn_device(struct uinput_device *udev)
372 if (test_bit(UIST_CREATED, &udev->state)) 371 if (test_bit(UIST_CREATED, &udev->state))
373 uinput_destroy_device(udev); 372 uinput_destroy_device(udev);
374 373
375 if (udev->dev->name) 374 kfree(udev->dev->name);
376 kfree(udev->dev->name); 375 kfree(udev->dev->phys);
377 if (udev->dev->phys)
378 kfree(udev->dev->phys);
379
380 kfree(udev->dev); 376 kfree(udev->dev);
381 kfree(udev); 377 kfree(udev);
382 378
diff --git a/drivers/macintosh/adbhid.c b/drivers/macintosh/adbhid.c
index 8f02c155fdc0..c0b46bceb5df 100644
--- a/drivers/macintosh/adbhid.c
+++ b/drivers/macintosh/adbhid.c
@@ -857,8 +857,7 @@ adbhid_input_register(int id, int default_id, int original_handler_id,
857static void adbhid_input_unregister(int id) 857static void adbhid_input_unregister(int id)
858{ 858{
859 input_unregister_device(adbhid[id]->input); 859 input_unregister_device(adbhid[id]->input);
860 if (adbhid[id]->keycode) 860 kfree(adbhid[id]->keycode);
861 kfree(adbhid[id]->keycode);
862 kfree(adbhid[id]); 861 kfree(adbhid[id]);
863 adbhid[id] = NULL; 862 adbhid[id] = NULL;
864} 863}
diff --git a/drivers/mmc/wbsd.c b/drivers/mmc/wbsd.c
index 4ff67e7363d9..e954b8354fef 100644
--- a/drivers/mmc/wbsd.c
+++ b/drivers/mmc/wbsd.c
@@ -1602,8 +1602,7 @@ static void __devexit wbsd_release_dma(struct wbsd_host* host)
1602 if (host->dma_addr) 1602 if (host->dma_addr)
1603 dma_unmap_single(host->mmc->dev, host->dma_addr, WBSD_DMA_SIZE, 1603 dma_unmap_single(host->mmc->dev, host->dma_addr, WBSD_DMA_SIZE,
1604 DMA_BIDIRECTIONAL); 1604 DMA_BIDIRECTIONAL);
1605 if (host->dma_buffer) 1605 kfree(host->dma_buffer);
1606 kfree(host->dma_buffer);
1607 if (host->dma >= 0) 1606 if (host->dma >= 0)
1608 free_dma(host->dma); 1607 free_dma(host->dma);
1609 1608
diff --git a/drivers/parport/probe.c b/drivers/parport/probe.c
index 6e6f42d01e64..4b48b31ec235 100644
--- a/drivers/parport/probe.c
+++ b/drivers/parport/probe.c
@@ -78,17 +78,15 @@ static void parse_data(struct parport *port, int device, char *str)
78 u++; 78 u++;
79 } 79 }
80 if (!strcmp(p, "MFG") || !strcmp(p, "MANUFACTURER")) { 80 if (!strcmp(p, "MFG") || !strcmp(p, "MANUFACTURER")) {
81 if (info->mfr) 81 kfree(info->mfr);
82 kfree (info->mfr);
83 info->mfr = kstrdup(sep, GFP_KERNEL); 82 info->mfr = kstrdup(sep, GFP_KERNEL);
84 } else if (!strcmp(p, "MDL") || !strcmp(p, "MODEL")) { 83 } else if (!strcmp(p, "MDL") || !strcmp(p, "MODEL")) {
85 if (info->model) 84 kfree(info->model);
86 kfree (info->model);
87 info->model = kstrdup(sep, GFP_KERNEL); 85 info->model = kstrdup(sep, GFP_KERNEL);
88 } else if (!strcmp(p, "CLS") || !strcmp(p, "CLASS")) { 86 } else if (!strcmp(p, "CLS") || !strcmp(p, "CLASS")) {
89 int i; 87 int i;
90 if (info->class_name) 88
91 kfree (info->class_name); 89 kfree(info->class_name);
92 info->class_name = kstrdup(sep, GFP_KERNEL); 90 info->class_name = kstrdup(sep, GFP_KERNEL);
93 for (u = sep; *u; u++) 91 for (u = sep; *u; u++)
94 *u = toupper(*u); 92 *u = toupper(*u);
@@ -102,21 +100,22 @@ static void parse_data(struct parport *port, int device, char *str)
102 info->class = PARPORT_CLASS_OTHER; 100 info->class = PARPORT_CLASS_OTHER;
103 } else if (!strcmp(p, "CMD") || 101 } else if (!strcmp(p, "CMD") ||
104 !strcmp(p, "COMMAND SET")) { 102 !strcmp(p, "COMMAND SET")) {
105 if (info->cmdset) 103 kfree(info->cmdset);
106 kfree (info->cmdset);
107 info->cmdset = kstrdup(sep, GFP_KERNEL); 104 info->cmdset = kstrdup(sep, GFP_KERNEL);
108 /* if it speaks printer language, it's 105 /* if it speaks printer language, it's
109 probably a printer */ 106 probably a printer */
110 if (strstr(sep, "PJL") || strstr(sep, "PCL")) 107 if (strstr(sep, "PJL") || strstr(sep, "PCL"))
111 guessed_class = PARPORT_CLASS_PRINTER; 108 guessed_class = PARPORT_CLASS_PRINTER;
112 } else if (!strcmp(p, "DES") || !strcmp(p, "DESCRIPTION")) { 109 } else if (!strcmp(p, "DES") || !strcmp(p, "DESCRIPTION")) {
113 if (info->description) 110 kfree(info->description);
114 kfree (info->description);
115 info->description = kstrdup(sep, GFP_KERNEL); 111 info->description = kstrdup(sep, GFP_KERNEL);
116 } 112 }
117 } 113 }
118 rock_on: 114 rock_on:
119 if (q) p = q+1; else p=NULL; 115 if (q)
116 p = q + 1;
117 else
118 p = NULL;
120 } 119 }
121 120
122 /* If the device didn't tell us its class, maybe we have managed to 121 /* If the device didn't tell us its class, maybe we have managed to
diff --git a/drivers/parport/share.c b/drivers/parport/share.c
index ae7becf7efa5..9cb3ab156b09 100644
--- a/drivers/parport/share.c
+++ b/drivers/parport/share.c
@@ -202,16 +202,11 @@ static void free_port (struct parport *port)
202 list_del(&port->full_list); 202 list_del(&port->full_list);
203 spin_unlock(&full_list_lock); 203 spin_unlock(&full_list_lock);
204 for (d = 0; d < 5; d++) { 204 for (d = 0; d < 5; d++) {
205 if (port->probe_info[d].class_name) 205 kfree(port->probe_info[d].class_name);
206 kfree (port->probe_info[d].class_name); 206 kfree(port->probe_info[d].mfr);
207 if (port->probe_info[d].mfr) 207 kfree(port->probe_info[d].model);
208 kfree (port->probe_info[d].mfr); 208 kfree(port->probe_info[d].cmdset);
209 if (port->probe_info[d].model) 209 kfree(port->probe_info[d].description);
210 kfree (port->probe_info[d].model);
211 if (port->probe_info[d].cmdset)
212 kfree (port->probe_info[d].cmdset);
213 if (port->probe_info[d].description)
214 kfree (port->probe_info[d].description);
215 } 210 }
216 211
217 kfree(port->name); 212 kfree(port->name);
@@ -618,9 +613,9 @@ parport_register_device(struct parport *port, const char *name,
618 return tmp; 613 return tmp;
619 614
620 out_free_all: 615 out_free_all:
621 kfree (tmp->state); 616 kfree(tmp->state);
622 out_free_pardevice: 617 out_free_pardevice:
623 kfree (tmp); 618 kfree(tmp);
624 out: 619 out:
625 parport_put_port (port); 620 parport_put_port (port);
626 module_put(port->ops->owner); 621 module_put(port->ops->owner);
diff --git a/drivers/pci/hotplug/cpqphp_pci.c b/drivers/pci/hotplug/cpqphp_pci.c
index 93e39c4096a9..00b81a7bdd26 100644
--- a/drivers/pci/hotplug/cpqphp_pci.c
+++ b/drivers/pci/hotplug/cpqphp_pci.c
@@ -259,8 +259,7 @@ static int PCI_GetBusDevHelper(struct controller *ctrl, u8 *bus_num, u8 *dev_num
259 sizeof(struct irq_routing_table)) / sizeof(struct irq_info); 259 sizeof(struct irq_routing_table)) / sizeof(struct irq_info);
260 // Make sure I got at least one entry 260 // Make sure I got at least one entry
261 if (len == 0) { 261 if (len == 0) {
262 if (PCIIRQRoutingInfoLength != NULL) 262 kfree(PCIIRQRoutingInfoLength );
263 kfree(PCIIRQRoutingInfoLength );
264 return -1; 263 return -1;
265 } 264 }
266 265
@@ -275,8 +274,7 @@ static int PCI_GetBusDevHelper(struct controller *ctrl, u8 *bus_num, u8 *dev_num
275 ctrl->pci_bus->number = tbus; 274 ctrl->pci_bus->number = tbus;
276 pci_bus_read_config_dword (ctrl->pci_bus, *dev_num, PCI_VENDOR_ID, &work); 275 pci_bus_read_config_dword (ctrl->pci_bus, *dev_num, PCI_VENDOR_ID, &work);
277 if (!nobridge || (work == 0xffffffff)) { 276 if (!nobridge || (work == 0xffffffff)) {
278 if (PCIIRQRoutingInfoLength != NULL) 277 kfree(PCIIRQRoutingInfoLength );
279 kfree(PCIIRQRoutingInfoLength );
280 return 0; 278 return 0;
281 } 279 }
282 280
@@ -289,20 +287,17 @@ static int PCI_GetBusDevHelper(struct controller *ctrl, u8 *bus_num, u8 *dev_num
289 dbg("Scan bus for Non Bridge: bus %d\n", tbus); 287 dbg("Scan bus for Non Bridge: bus %d\n", tbus);
290 if (PCI_ScanBusForNonBridge(ctrl, tbus, dev_num) == 0) { 288 if (PCI_ScanBusForNonBridge(ctrl, tbus, dev_num) == 0) {
291 *bus_num = tbus; 289 *bus_num = tbus;
292 if (PCIIRQRoutingInfoLength != NULL) 290 kfree(PCIIRQRoutingInfoLength );
293 kfree(PCIIRQRoutingInfoLength );
294 return 0; 291 return 0;
295 } 292 }
296 } else { 293 } else {
297 if (PCIIRQRoutingInfoLength != NULL) 294 kfree(PCIIRQRoutingInfoLength );
298 kfree(PCIIRQRoutingInfoLength );
299 return 0; 295 return 0;
300 } 296 }
301 297
302 } 298 }
303 } 299 }
304 if (PCIIRQRoutingInfoLength != NULL) 300 kfree(PCIIRQRoutingInfoLength );
305 kfree(PCIIRQRoutingInfoLength );
306 return -1; 301 return -1;
307} 302}
308 303
diff --git a/drivers/pcmcia/cistpl.c b/drivers/pcmcia/cistpl.c
index 3afb682255a0..2dc3e611a9a3 100644
--- a/drivers/pcmcia/cistpl.c
+++ b/drivers/pcmcia/cistpl.c
@@ -334,10 +334,8 @@ void destroy_cis_cache(struct pcmcia_socket *s)
334 /* 334 /*
335 * If there was a fake CIS, destroy that as well. 335 * If there was a fake CIS, destroy that as well.
336 */ 336 */
337 if (s->fake_cis) { 337 kfree(s->fake_cis);
338 kfree(s->fake_cis); 338 s->fake_cis = NULL;
339 s->fake_cis = NULL;
340 }
341} 339}
342EXPORT_SYMBOL(destroy_cis_cache); 340EXPORT_SYMBOL(destroy_cis_cache);
343 341
@@ -386,10 +384,8 @@ int verify_cis_cache(struct pcmcia_socket *s)
386 384
387int pcmcia_replace_cis(struct pcmcia_socket *s, cisdump_t *cis) 385int pcmcia_replace_cis(struct pcmcia_socket *s, cisdump_t *cis)
388{ 386{
389 if (s->fake_cis != NULL) { 387 kfree(s->fake_cis);
390 kfree(s->fake_cis); 388 s->fake_cis = NULL;
391 s->fake_cis = NULL;
392 }
393 if (cis->Length > CISTPL_MAX_CIS_SIZE) 389 if (cis->Length > CISTPL_MAX_CIS_SIZE)
394 return CS_BAD_SIZE; 390 return CS_BAD_SIZE;
395 s->fake_cis = kmalloc(cis->Length, GFP_KERNEL); 391 s->fake_cis = kmalloc(cis->Length, GFP_KERNEL);
diff --git a/drivers/pcmcia/cs.c b/drivers/pcmcia/cs.c
index d5e76423a0ee..234cdca6fe13 100644
--- a/drivers/pcmcia/cs.c
+++ b/drivers/pcmcia/cs.c
@@ -331,10 +331,8 @@ static void shutdown_socket(struct pcmcia_socket *s)
331 cb_free(s); 331 cb_free(s);
332#endif 332#endif
333 s->functions = 0; 333 s->functions = 0;
334 if (s->config) { 334 kfree(s->config);
335 kfree(s->config); 335 s->config = NULL;
336 s->config = NULL;
337 }
338 336
339 { 337 {
340 int status; 338 int status;
diff --git a/drivers/sbus/char/envctrl.c b/drivers/sbus/char/envctrl.c
index b0cc3c2588fd..ba56762b05f6 100644
--- a/drivers/sbus/char/envctrl.c
+++ b/drivers/sbus/char/envctrl.c
@@ -1125,10 +1125,9 @@ out_deregister:
1125 misc_deregister(&envctrl_dev); 1125 misc_deregister(&envctrl_dev);
1126out_iounmap: 1126out_iounmap:
1127 iounmap(i2c); 1127 iounmap(i2c);
1128 for (i = 0; i < ENVCTRL_MAX_CPU * 2; i++) { 1128 for (i = 0; i < ENVCTRL_MAX_CPU * 2; i++)
1129 if (i2c_childlist[i].tables) 1129 kfree(i2c_childlist[i].tables);
1130 kfree(i2c_childlist[i].tables); 1130
1131 }
1132 return err; 1131 return err;
1133} 1132}
1134 1133
@@ -1141,10 +1140,8 @@ static void __exit envctrl_cleanup(void)
1141 iounmap(i2c); 1140 iounmap(i2c);
1142 misc_deregister(&envctrl_dev); 1141 misc_deregister(&envctrl_dev);
1143 1142
1144 for (i = 0; i < ENVCTRL_MAX_CPU * 2; i++) { 1143 for (i = 0; i < ENVCTRL_MAX_CPU * 2; i++)
1145 if (i2c_childlist[i].tables) 1144 kfree(i2c_childlist[i].tables);
1146 kfree(i2c_childlist[i].tables);
1147 }
1148} 1145}
1149 1146
1150module_init(envctrl_init); 1147module_init(envctrl_init);
diff --git a/drivers/video/i810/i810_main.c b/drivers/video/i810/i810_main.c
index 1d148c5a5a4b..c0c974b1afaa 100644
--- a/drivers/video/i810/i810_main.c
+++ b/drivers/video/i810/i810_main.c
@@ -2057,8 +2057,7 @@ static void i810fb_release_resource(struct fb_info *info,
2057 iounmap(par->mmio_start_virtual); 2057 iounmap(par->mmio_start_virtual);
2058 if (par->aperture.virtual) 2058 if (par->aperture.virtual)
2059 iounmap(par->aperture.virtual); 2059 iounmap(par->aperture.virtual);
2060 if (par->edid) 2060 kfree(par->edid);
2061 kfree(par->edid);
2062 if (par->res_flags & FRAMEBUFFER_REQ) 2061 if (par->res_flags & FRAMEBUFFER_REQ)
2063 release_mem_region(par->aperture.physical, 2062 release_mem_region(par->aperture.physical,
2064 par->aperture.size); 2063 par->aperture.size);
diff --git a/drivers/w1/w1_ds2433.c b/drivers/w1/w1_ds2433.c
index 279e0e0363d6..1e3d98aac12d 100644
--- a/drivers/w1/w1_ds2433.c
+++ b/drivers/w1/w1_ds2433.c
@@ -299,10 +299,8 @@ static int w1_f23_add_slave(struct w1_slave *sl)
299static void w1_f23_remove_slave(struct w1_slave *sl) 299static void w1_f23_remove_slave(struct w1_slave *sl)
300{ 300{
301#ifdef CONFIG_W1_F23_CRC 301#ifdef CONFIG_W1_F23_CRC
302 if (sl->family_data) { 302 kfree(sl->family_data);
303 kfree(sl->family_data); 303 sl->family_data = NULL;
304 sl->family_data = NULL;
305 }
306#endif /* CONFIG_W1_F23_CRC */ 304#endif /* CONFIG_W1_F23_CRC */
307 sysfs_remove_bin_file(&sl->dev.kobj, &w1_f23_bin_attr); 305 sysfs_remove_bin_file(&sl->dev.kobj, &w1_f23_bin_attr);
308} 306}