diff options
Diffstat (limited to 'drivers/ide/ide.c')
-rw-r--r-- | drivers/ide/ide.c | 6 |
1 files changed, 2 insertions, 4 deletions
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; |
890 | abort: | 889 | abort: |
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 | ||