diff options
Diffstat (limited to 'drivers/ide/ide-cd.c')
-rw-r--r-- | drivers/ide/ide-cd.c | 22 |
1 files changed, 7 insertions, 15 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); |