aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/block/dasd_diag.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/s390/block/dasd_diag.c')
-rw-r--r--drivers/s390/block/dasd_diag.c25
1 files changed, 18 insertions, 7 deletions
diff --git a/drivers/s390/block/dasd_diag.c b/drivers/s390/block/dasd_diag.c
index d91df38ee4f7..85fcb4371054 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 = -EOPNOTSUPP;
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 = -EOPNOTSUPP;
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 }
442out: 446out_label:
443 free_page((long) label); 447 free_page((long) label);
448out:
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