diff options
author | Cornelia Huck <cornelia.huck@de.ibm.com> | 2008-07-17 11:16:43 -0400 |
---|---|---|
committer | Heiko Carstens <heiko.carstens@de.ibm.com> | 2008-07-17 11:22:08 -0400 |
commit | 7337194f708bac977511c7890d7038ded187041a (patch) | |
tree | bf7bb40487f374b00403f92f029167f6f0bed0d1 /drivers | |
parent | 626f311737770f0fb5c09a6da2ea795a559aa42a (diff) |
[S390] dasd: Fix cleanup in dasd_{fba,diag}_check_characteristics().
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/s390/block/dasd_diag.c | 25 | ||||
-rw-r--r-- | drivers/s390/block/dasd_fba.c | 7 |
2 files changed, 24 insertions, 8 deletions
diff --git a/drivers/s390/block/dasd_diag.c b/drivers/s390/block/dasd_diag.c index d91df38ee4f7..ab5c5b43bdcf 100644 --- a/drivers/s390/block/dasd_diag.c +++ b/drivers/s390/block/dasd_diag.c | |||
@@ -333,7 +333,8 @@ dasd_diag_check_device(struct dasd_device *device) | |||
333 | if (IS_ERR(block)) { | 333 | if (IS_ERR(block)) { |
334 | DEV_MESSAGE(KERN_WARNING, device, "%s", | 334 | DEV_MESSAGE(KERN_WARNING, device, "%s", |
335 | "could not allocate dasd block structure"); | 335 | "could not allocate dasd block structure"); |
336 | kfree(device->private); | 336 | device->private = NULL; |
337 | kfree(private); | ||
337 | return PTR_ERR(block); | 338 | return PTR_ERR(block); |
338 | } | 339 | } |
339 | device->block = block; | 340 | device->block = block; |
@@ -348,7 +349,8 @@ dasd_diag_check_device(struct dasd_device *device) | |||
348 | if (rc) { | 349 | if (rc) { |
349 | DEV_MESSAGE(KERN_WARNING, device, "failed to retrieve device " | 350 | DEV_MESSAGE(KERN_WARNING, device, "failed to retrieve device " |
350 | "information (rc=%d)", rc); | 351 | "information (rc=%d)", rc); |
351 | return -ENOTSUPP; | 352 | rc = -ENOTSUPP; |
353 | goto out; | ||
352 | } | 354 | } |
353 | 355 | ||
354 | /* Figure out position of label block */ | 356 | /* Figure out position of label block */ |
@@ -362,7 +364,8 @@ dasd_diag_check_device(struct dasd_device *device) | |||
362 | default: | 364 | default: |
363 | DEV_MESSAGE(KERN_WARNING, device, "unsupported device class " | 365 | DEV_MESSAGE(KERN_WARNING, device, "unsupported device class " |
364 | "(class=%d)", private->rdc_data.vdev_class); | 366 | "(class=%d)", private->rdc_data.vdev_class); |
365 | return -ENOTSUPP; | 367 | rc = -ENOTSUPP; |
368 | goto out; | ||
366 | } | 369 | } |
367 | 370 | ||
368 | DBF_DEV_EVENT(DBF_INFO, device, | 371 | DBF_DEV_EVENT(DBF_INFO, device, |
@@ -379,7 +382,8 @@ dasd_diag_check_device(struct dasd_device *device) | |||
379 | if (label == NULL) { | 382 | if (label == NULL) { |
380 | DEV_MESSAGE(KERN_WARNING, device, "%s", | 383 | DEV_MESSAGE(KERN_WARNING, device, "%s", |
381 | "No memory to allocate initialization request"); | 384 | "No memory to allocate initialization request"); |
382 | return -ENOMEM; | 385 | rc = -ENOMEM; |
386 | goto out; | ||
383 | } | 387 | } |
384 | rc = 0; | 388 | rc = 0; |
385 | end_block = 0; | 389 | end_block = 0; |
@@ -403,7 +407,7 @@ dasd_diag_check_device(struct dasd_device *device) | |||
403 | DEV_MESSAGE(KERN_WARNING, device, "%s", | 407 | DEV_MESSAGE(KERN_WARNING, device, "%s", |
404 | "DIAG call failed"); | 408 | "DIAG call failed"); |
405 | rc = -EOPNOTSUPP; | 409 | rc = -EOPNOTSUPP; |
406 | goto out; | 410 | goto out_label; |
407 | } | 411 | } |
408 | mdsk_term_io(device); | 412 | mdsk_term_io(device); |
409 | if (rc == 0) | 413 | if (rc == 0) |
@@ -413,7 +417,7 @@ dasd_diag_check_device(struct dasd_device *device) | |||
413 | DEV_MESSAGE(KERN_WARNING, device, "device access failed " | 417 | DEV_MESSAGE(KERN_WARNING, device, "device access failed " |
414 | "(rc=%d)", rc); | 418 | "(rc=%d)", rc); |
415 | rc = -EIO; | 419 | rc = -EIO; |
416 | goto out; | 420 | goto out_label; |
417 | } | 421 | } |
418 | /* check for label block */ | 422 | /* check for label block */ |
419 | if (memcmp(label->label_id, DASD_DIAG_CMS1, | 423 | if (memcmp(label->label_id, DASD_DIAG_CMS1, |
@@ -439,8 +443,15 @@ dasd_diag_check_device(struct dasd_device *device) | |||
439 | (unsigned long) (block->blocks << | 443 | (unsigned long) (block->blocks << |
440 | block->s2b_shift) >> 1); | 444 | block->s2b_shift) >> 1); |
441 | } | 445 | } |
442 | out: | 446 | out_label: |
443 | free_page((long) label); | 447 | free_page((long) label); |
448 | out: | ||
449 | if (rc) { | ||
450 | device->block = NULL; | ||
451 | dasd_free_block(block); | ||
452 | device->private = NULL; | ||
453 | kfree(private); | ||
454 | } | ||
444 | return rc; | 455 | return rc; |
445 | } | 456 | } |
446 | 457 | ||
diff --git a/drivers/s390/block/dasd_fba.c b/drivers/s390/block/dasd_fba.c index aee4656127f7..aa0c533423a5 100644 --- a/drivers/s390/block/dasd_fba.c +++ b/drivers/s390/block/dasd_fba.c | |||
@@ -139,7 +139,8 @@ dasd_fba_check_characteristics(struct dasd_device *device) | |||
139 | if (IS_ERR(block)) { | 139 | if (IS_ERR(block)) { |
140 | DEV_MESSAGE(KERN_WARNING, device, "%s", | 140 | DEV_MESSAGE(KERN_WARNING, device, "%s", |
141 | "could not allocate dasd block structure"); | 141 | "could not allocate dasd block structure"); |
142 | kfree(device->private); | 142 | device->private = NULL; |
143 | kfree(private); | ||
143 | return PTR_ERR(block); | 144 | return PTR_ERR(block); |
144 | } | 145 | } |
145 | device->block = block; | 146 | device->block = block; |
@@ -152,6 +153,10 @@ dasd_fba_check_characteristics(struct dasd_device *device) | |||
152 | DEV_MESSAGE(KERN_WARNING, device, | 153 | DEV_MESSAGE(KERN_WARNING, device, |
153 | "Read device characteristics returned error %d", | 154 | "Read device characteristics returned error %d", |
154 | rc); | 155 | rc); |
156 | device->block = NULL; | ||
157 | dasd_free_block(block); | ||
158 | device->private = NULL; | ||
159 | kfree(private); | ||
155 | return rc; | 160 | return rc; |
156 | } | 161 | } |
157 | 162 | ||