aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide')
-rw-r--r--drivers/ide/ide-cd.c22
-rw-r--r--drivers/ide/ide-disk.c4
-rw-r--r--drivers/ide/ide-floppy.c4
-rw-r--r--drivers/ide/ide-probe.c9
-rw-r--r--drivers/ide/ide-tape.c4
-rw-r--r--drivers/ide/ide-taskfile.c18
-rw-r--r--drivers/ide/ide.c6
-rw-r--r--drivers/ide/legacy/ide-cs.c6
-rw-r--r--drivers/ide/pci/hpt366.c3
-rw-r--r--drivers/ide/pci/it821x.c3
10 files changed, 25 insertions, 54 deletions
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 8b9d85526596..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);
@@ -3455,7 +3452,7 @@ static int ide_cd_probe(struct device *dev)
3455 printk(KERN_INFO "ide-cd: passing drive %s to ide-scsi emulation.\n", drive->name); 3452 printk(KERN_INFO "ide-cd: passing drive %s to ide-scsi emulation.\n", drive->name);
3456 goto failed; 3453 goto failed;
3457 } 3454 }
3458 info = kmalloc(sizeof(struct cdrom_info), GFP_KERNEL); 3455 info = kzalloc(sizeof(struct cdrom_info), GFP_KERNEL);
3459 if (info == NULL) { 3456 if (info == NULL) {
3460 printk(KERN_ERR "%s: Can't allocate a cdrom structure\n", drive->name); 3457 printk(KERN_ERR "%s: Can't allocate a cdrom structure\n", drive->name);
3461 goto failed; 3458 goto failed;
@@ -3469,8 +3466,6 @@ static int ide_cd_probe(struct device *dev)
3469 3466
3470 ide_register_subdriver(drive, &ide_cdrom_driver); 3467 ide_register_subdriver(drive, &ide_cdrom_driver);
3471 3468
3472 memset(info, 0, sizeof (struct cdrom_info));
3473
3474 kref_init(&info->kref); 3469 kref_init(&info->kref);
3475 3470
3476 info->drive = drive; 3471 info->drive = drive;
@@ -3489,12 +3484,9 @@ static int ide_cd_probe(struct device *dev)
3489 if (ide_cdrom_setup(drive)) { 3484 if (ide_cdrom_setup(drive)) {
3490 struct cdrom_device_info *devinfo = &info->devinfo; 3485 struct cdrom_device_info *devinfo = &info->devinfo;
3491 ide_unregister_subdriver(drive, &ide_cdrom_driver); 3486 ide_unregister_subdriver(drive, &ide_cdrom_driver);
3492 if (info->buffer != NULL) 3487 kfree(info->buffer);
3493 kfree(info->buffer); 3488 kfree(info->toc);
3494 if (info->toc != NULL) 3489 kfree(info->changer_info);
3495 kfree(info->toc);
3496 if (info->changer_info != NULL)
3497 kfree(info->changer_info);
3498 if (devinfo->handle == drive && unregister_cdrom(devinfo)) 3490 if (devinfo->handle == drive && unregister_cdrom(devinfo))
3499 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);
3500 kfree(info); 3492 kfree(info);
diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c
index 234f5de3e929..e827b39e4b3c 100644
--- a/drivers/ide/ide-disk.c
+++ b/drivers/ide/ide-disk.c
@@ -1215,7 +1215,7 @@ static int ide_disk_probe(struct device *dev)
1215 if (drive->media != ide_disk) 1215 if (drive->media != ide_disk)
1216 goto failed; 1216 goto failed;
1217 1217
1218 idkp = kmalloc(sizeof(*idkp), GFP_KERNEL); 1218 idkp = kzalloc(sizeof(*idkp), GFP_KERNEL);
1219 if (!idkp) 1219 if (!idkp)
1220 goto failed; 1220 goto failed;
1221 1221
@@ -1228,8 +1228,6 @@ static int ide_disk_probe(struct device *dev)
1228 1228
1229 ide_register_subdriver(drive, &idedisk_driver); 1229 ide_register_subdriver(drive, &idedisk_driver);
1230 1230
1231 memset(idkp, 0, sizeof(*idkp));
1232
1233 kref_init(&idkp->kref); 1231 kref_init(&idkp->kref);
1234 1232
1235 idkp->drive = drive; 1233 idkp->drive = drive;
diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c
index 29c22fc278c6..e83f54d37f96 100644
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -2146,7 +2146,7 @@ static int ide_floppy_probe(struct device *dev)
2146 printk("ide-floppy: passing drive %s to ide-scsi emulation.\n", drive->name); 2146 printk("ide-floppy: passing drive %s to ide-scsi emulation.\n", drive->name);
2147 goto failed; 2147 goto failed;
2148 } 2148 }
2149 if ((floppy = (idefloppy_floppy_t *) kmalloc (sizeof (idefloppy_floppy_t), GFP_KERNEL)) == NULL) { 2149 if ((floppy = (idefloppy_floppy_t *) kzalloc (sizeof (idefloppy_floppy_t), GFP_KERNEL)) == NULL) {
2150 printk (KERN_ERR "ide-floppy: %s: Can't allocate a floppy structure\n", drive->name); 2150 printk (KERN_ERR "ide-floppy: %s: Can't allocate a floppy structure\n", drive->name);
2151 goto failed; 2151 goto failed;
2152 } 2152 }
@@ -2159,8 +2159,6 @@ static int ide_floppy_probe(struct device *dev)
2159 2159
2160 ide_register_subdriver(drive, &idefloppy_driver); 2160 ide_register_subdriver(drive, &idefloppy_driver);
2161 2161
2162 memset(floppy, 0, sizeof(*floppy));
2163
2164 kref_init(&floppy->kref); 2162 kref_init(&floppy->kref);
2165 2163
2166 floppy->drive = drive; 2164 floppy->drive = drive;
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c
index c1128ae5cd2f..02167a5b751d 100644
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -596,14 +596,13 @@ static inline u8 probe_for_drive (ide_drive_t *drive)
596 * Also note that 0 everywhere means "can't do X" 596 * Also note that 0 everywhere means "can't do X"
597 */ 597 */
598 598
599 drive->id = kmalloc(SECTOR_WORDS *4, GFP_KERNEL); 599 drive->id = kzalloc(SECTOR_WORDS *4, GFP_KERNEL);
600 drive->id_read = 0; 600 drive->id_read = 0;
601 if(drive->id == NULL) 601 if(drive->id == NULL)
602 { 602 {
603 printk(KERN_ERR "ide: out of memory for id data.\n"); 603 printk(KERN_ERR "ide: out of memory for id data.\n");
604 return 0; 604 return 0;
605 } 605 }
606 memset(drive->id, 0, SECTOR_WORDS * 4);
607 strcpy(drive->id->model, "UNKNOWN"); 606 strcpy(drive->id->model, "UNKNOWN");
608 607
609 /* skip probing? */ 608 /* skip probing? */
@@ -1316,10 +1315,8 @@ static void drive_release_dev (struct device *dev)
1316 drive->devfs_name[0] = '\0'; 1315 drive->devfs_name[0] = '\0';
1317 } 1316 }
1318 ide_remove_drive_from_hwgroup(drive); 1317 ide_remove_drive_from_hwgroup(drive);
1319 if (drive->id != NULL) { 1318 kfree(drive->id);
1320 kfree(drive->id); 1319 drive->id = NULL;
1321 drive->id = NULL;
1322 }
1323 drive->present = 0; 1320 drive->present = 0;
1324 /* Messed up locking ... */ 1321 /* Messed up locking ... */
1325 spin_unlock_irq(&ide_lock); 1322 spin_unlock_irq(&ide_lock);
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
index 47f2b832555f..0ac7eb8f40d5 100644
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -4850,7 +4850,7 @@ static int ide_tape_probe(struct device *dev)
4850 printk(KERN_WARNING "ide-tape: Use drive %s with ide-scsi emulation and osst.\n", drive->name); 4850 printk(KERN_WARNING "ide-tape: Use drive %s with ide-scsi emulation and osst.\n", drive->name);
4851 printk(KERN_WARNING "ide-tape: OnStream support will be removed soon from ide-tape!\n"); 4851 printk(KERN_WARNING "ide-tape: OnStream support will be removed soon from ide-tape!\n");
4852 } 4852 }
4853 tape = (idetape_tape_t *) kmalloc (sizeof (idetape_tape_t), GFP_KERNEL); 4853 tape = (idetape_tape_t *) kzalloc (sizeof (idetape_tape_t), GFP_KERNEL);
4854 if (tape == NULL) { 4854 if (tape == NULL) {
4855 printk(KERN_ERR "ide-tape: %s: Can't allocate a tape structure\n", drive->name); 4855 printk(KERN_ERR "ide-tape: %s: Can't allocate a tape structure\n", drive->name);
4856 goto failed; 4856 goto failed;
@@ -4864,8 +4864,6 @@ static int ide_tape_probe(struct device *dev)
4864 4864
4865 ide_register_subdriver(drive, &idetape_driver); 4865 ide_register_subdriver(drive, &idetape_driver);
4866 4866
4867 memset(tape, 0, sizeof(*tape));
4868
4869 kref_init(&tape->kref); 4867 kref_init(&tape->kref);
4870 4868
4871 tape->drive = drive; 4869 tape->drive = drive;
diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c
index ace8edad6e96..7ec18fa3b5ff 100644
--- a/drivers/ide/ide-taskfile.c
+++ b/drivers/ide/ide-taskfile.c
@@ -528,9 +528,8 @@ int ide_taskfile_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg)
528 528
529// printk("IDE Taskfile ...\n"); 529// printk("IDE Taskfile ...\n");
530 530
531 req_task = kmalloc(tasksize, GFP_KERNEL); 531 req_task = kzalloc(tasksize, GFP_KERNEL);
532 if (req_task == NULL) return -ENOMEM; 532 if (req_task == NULL) return -ENOMEM;
533 memset(req_task, 0, tasksize);
534 if (copy_from_user(req_task, buf, tasksize)) { 533 if (copy_from_user(req_task, buf, tasksize)) {
535 kfree(req_task); 534 kfree(req_task);
536 return -EFAULT; 535 return -EFAULT;
@@ -541,12 +540,11 @@ int ide_taskfile_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg)
541 540
542 if (taskout) { 541 if (taskout) {
543 int outtotal = tasksize; 542 int outtotal = tasksize;
544 outbuf = kmalloc(taskout, GFP_KERNEL); 543 outbuf = kzalloc(taskout, GFP_KERNEL);
545 if (outbuf == NULL) { 544 if (outbuf == NULL) {
546 err = -ENOMEM; 545 err = -ENOMEM;
547 goto abort; 546 goto abort;
548 } 547 }
549 memset(outbuf, 0, taskout);
550 if (copy_from_user(outbuf, buf + outtotal, taskout)) { 548 if (copy_from_user(outbuf, buf + outtotal, taskout)) {
551 err = -EFAULT; 549 err = -EFAULT;
552 goto abort; 550 goto abort;
@@ -555,12 +553,11 @@ int ide_taskfile_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg)
555 553
556 if (taskin) { 554 if (taskin) {
557 int intotal = tasksize + taskout; 555 int intotal = tasksize + taskout;
558 inbuf = kmalloc(taskin, GFP_KERNEL); 556 inbuf = kzalloc(taskin, GFP_KERNEL);
559 if (inbuf == NULL) { 557 if (inbuf == NULL) {
560 err = -ENOMEM; 558 err = -ENOMEM;
561 goto abort; 559 goto abort;
562 } 560 }
563 memset(inbuf, 0, taskin);
564 if (copy_from_user(inbuf, buf + intotal, taskin)) { 561 if (copy_from_user(inbuf, buf + intotal, taskin)) {
565 err = -EFAULT; 562 err = -EFAULT;
566 goto abort; 563 goto abort;
@@ -649,10 +646,8 @@ int ide_taskfile_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg)
649 } 646 }
650abort: 647abort:
651 kfree(req_task); 648 kfree(req_task);
652 if (outbuf != NULL) 649 kfree(outbuf);
653 kfree(outbuf); 650 kfree(inbuf);
654 if (inbuf != NULL)
655 kfree(inbuf);
656 651
657// printk("IDE Taskfile ioctl ended. rc = %i\n", err); 652// printk("IDE Taskfile ioctl ended. rc = %i\n", err);
658 653
@@ -709,10 +704,9 @@ int ide_cmd_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg)
709 704
710 if (args[3]) { 705 if (args[3]) {
711 argsize = 4 + (SECTOR_WORDS * 4 * args[3]); 706 argsize = 4 + (SECTOR_WORDS * 4 * args[3]);
712 argbuf = kmalloc(argsize, GFP_KERNEL); 707 argbuf = kzalloc(argsize, GFP_KERNEL);
713 if (argbuf == NULL) 708 if (argbuf == NULL)
714 return -ENOMEM; 709 return -ENOMEM;
715 memcpy(argbuf, args, 4);
716 } 710 }
717 if (set_transfer(drive, &tfargs)) { 711 if (set_transfer(drive, &tfargs)) {
718 xfer_rate = args[1]; 712 xfer_rate = args[1];
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c
index 73ca8f73917d..9fe19808d815 100644
--- a/drivers/ide/ide.c
+++ b/drivers/ide/ide.c
@@ -864,9 +864,8 @@ static int __ide_add_setting(ide_drive_t *drive, const char *name, int rw, int r
864 down(&ide_setting_sem); 864 down(&ide_setting_sem);
865 while ((*p) && strcmp((*p)->name, name) < 0) 865 while ((*p) && strcmp((*p)->name, name) < 0)
866 p = &((*p)->next); 866 p = &((*p)->next);
867 if ((setting = kmalloc(sizeof(*setting), GFP_KERNEL)) == NULL) 867 if ((setting = kzalloc(sizeof(*setting), GFP_KERNEL)) == NULL)
868 goto abort; 868 goto abort;
869 memset(setting, 0, sizeof(*setting));
870 if ((setting->name = kmalloc(strlen(name) + 1, GFP_KERNEL)) == NULL) 869 if ((setting->name = kmalloc(strlen(name) + 1, GFP_KERNEL)) == NULL)
871 goto abort; 870 goto abort;
872 strcpy(setting->name, name); 871 strcpy(setting->name, name);
@@ -889,8 +888,7 @@ static int __ide_add_setting(ide_drive_t *drive, const char *name, int rw, int r
889 return 0; 888 return 0;
890abort: 889abort:
891 up(&ide_setting_sem); 890 up(&ide_setting_sem);
892 if (setting) 891 kfree(setting);
893 kfree(setting);
894 return -1; 892 return -1;
895} 893}
896 894
diff --git a/drivers/ide/legacy/ide-cs.c b/drivers/ide/legacy/ide-cs.c
index a35a58bef1a4..1dafffa7e513 100644
--- a/drivers/ide/legacy/ide-cs.c
+++ b/drivers/ide/legacy/ide-cs.c
@@ -116,9 +116,8 @@ static dev_link_t *ide_attach(void)
116 DEBUG(0, "ide_attach()\n"); 116 DEBUG(0, "ide_attach()\n");
117 117
118 /* Create new ide device */ 118 /* Create new ide device */
119 info = kmalloc(sizeof(*info), GFP_KERNEL); 119 info = kzalloc(sizeof(*info), GFP_KERNEL);
120 if (!info) return NULL; 120 if (!info) return NULL;
121 memset(info, 0, sizeof(*info));
122 link = &info->link; link->priv = info; 121 link = &info->link; link->priv = info;
123 122
124 link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; 123 link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO;
@@ -221,9 +220,8 @@ static void ide_config(dev_link_t *link)
221 220
222 DEBUG(0, "ide_config(0x%p)\n", link); 221 DEBUG(0, "ide_config(0x%p)\n", link);
223 222
224 stk = kmalloc(sizeof(*stk), GFP_KERNEL); 223 stk = kzalloc(sizeof(*stk), GFP_KERNEL);
225 if (!stk) goto err_mem; 224 if (!stk) goto err_mem;
226 memset(stk, 0, sizeof(*stk));
227 cfg = &stk->parse.cftable_entry; 225 cfg = &stk->parse.cftable_entry;
228 226
229 tuple.TupleData = (cisdata_t *)&stk->buf; 227 tuple.TupleData = (cisdata_t *)&stk->buf;
diff --git a/drivers/ide/pci/hpt366.c b/drivers/ide/pci/hpt366.c
index 127619a109ed..7b589d948bf9 100644
--- a/drivers/ide/pci/hpt366.c
+++ b/drivers/ide/pci/hpt366.c
@@ -1516,7 +1516,7 @@ static void __devinit init_dma_hpt366(ide_hwif_t *hwif, unsigned long dmabase)
1516 1516
1517static void __devinit init_iops_hpt366(ide_hwif_t *hwif) 1517static void __devinit init_iops_hpt366(ide_hwif_t *hwif)
1518{ 1518{
1519 struct hpt_info *info = kmalloc(sizeof(struct hpt_info), GFP_KERNEL); 1519 struct hpt_info *info = kzalloc(sizeof(struct hpt_info), GFP_KERNEL);
1520 unsigned long dmabase = pci_resource_start(hwif->pci_dev, 4); 1520 unsigned long dmabase = pci_resource_start(hwif->pci_dev, 4);
1521 u8 did, rid; 1521 u8 did, rid;
1522 1522
@@ -1524,7 +1524,6 @@ static void __devinit init_iops_hpt366(ide_hwif_t *hwif)
1524 printk(KERN_WARNING "hpt366: out of memory.\n"); 1524 printk(KERN_WARNING "hpt366: out of memory.\n");
1525 return; 1525 return;
1526 } 1526 }
1527 memset(info, 0, sizeof(struct hpt_info));
1528 ide_set_hwifdata(hwif, info); 1527 ide_set_hwifdata(hwif, info);
1529 1528
1530 if(dmabase) { 1529 if(dmabase) {
diff --git a/drivers/ide/pci/it821x.c b/drivers/ide/pci/it821x.c
index e440036e651f..108fda83fea4 100644
--- a/drivers/ide/pci/it821x.c
+++ b/drivers/ide/pci/it821x.c
@@ -642,14 +642,13 @@ static void __devinit it821x_fixups(ide_hwif_t *hwif)
642 642
643static void __devinit init_hwif_it821x(ide_hwif_t *hwif) 643static void __devinit init_hwif_it821x(ide_hwif_t *hwif)
644{ 644{
645 struct it821x_dev *idev = kmalloc(sizeof(struct it821x_dev), GFP_KERNEL); 645 struct it821x_dev *idev = kzalloc(sizeof(struct it821x_dev), GFP_KERNEL);
646 u8 conf; 646 u8 conf;
647 647
648 if(idev == NULL) { 648 if(idev == NULL) {
649 printk(KERN_ERR "it821x: out of memory, falling back to legacy behaviour.\n"); 649 printk(KERN_ERR "it821x: out of memory, falling back to legacy behaviour.\n");
650 goto fallback; 650 goto fallback;
651 } 651 }
652 memset(idev, 0, sizeof(struct it821x_dev));
653 ide_set_hwifdata(hwif, idev); 652 ide_set_hwifdata(hwif, idev);
654 653
655 pci_read_config_byte(hwif->pci_dev, 0x50, &conf); 654 pci_read_config_byte(hwif->pci_dev, 0x50, &conf);