diff options
author | Sebastian Ott <sebott@linux.vnet.ibm.com> | 2009-06-12 04:26:37 -0400 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2009-06-12 04:27:35 -0400 |
commit | 92636b152f3b58e459988934f689619af9e04dbc (patch) | |
tree | 2736c3278fcc04cb9488ab740d7ed2dd8d1184a4 /drivers/s390/block/dasd_eckd.c | |
parent | 45b44d76d373e66d08e0c745dc82ff9123103588 (diff) |
[S390] dasd: check_characteristics cleanup
Fix a broken memset (sizeof pointer vs sizeof the underlying
structure) by cleaning up the involved functions.
Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'drivers/s390/block/dasd_eckd.c')
-rw-r--r-- | drivers/s390/block/dasd_eckd.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/drivers/s390/block/dasd_eckd.c b/drivers/s390/block/dasd_eckd.c index 81f8819eaf19..c4e818111a40 100644 --- a/drivers/s390/block/dasd_eckd.c +++ b/drivers/s390/block/dasd_eckd.c | |||
@@ -1097,20 +1097,20 @@ dasd_eckd_check_characteristics(struct dasd_device *device) | |||
1097 | { | 1097 | { |
1098 | struct dasd_eckd_private *private; | 1098 | struct dasd_eckd_private *private; |
1099 | struct dasd_block *block; | 1099 | struct dasd_block *block; |
1100 | void *rdc_data; | ||
1101 | int is_known, rc; | 1100 | int is_known, rc; |
1102 | 1101 | ||
1103 | private = (struct dasd_eckd_private *) device->private; | 1102 | private = (struct dasd_eckd_private *) device->private; |
1104 | if (private == NULL) { | 1103 | if (!private) { |
1105 | private = kzalloc(sizeof(struct dasd_eckd_private), | 1104 | private = kzalloc(sizeof(*private), GFP_KERNEL | GFP_DMA); |
1106 | GFP_KERNEL | GFP_DMA); | 1105 | if (!private) { |
1107 | if (private == NULL) { | ||
1108 | dev_warn(&device->cdev->dev, | 1106 | dev_warn(&device->cdev->dev, |
1109 | "Allocating memory for private DASD data " | 1107 | "Allocating memory for private DASD data " |
1110 | "failed\n"); | 1108 | "failed\n"); |
1111 | return -ENOMEM; | 1109 | return -ENOMEM; |
1112 | } | 1110 | } |
1113 | device->private = (void *) private; | 1111 | device->private = (void *) private; |
1112 | } else { | ||
1113 | memset(private, 0, sizeof(*private)); | ||
1114 | } | 1114 | } |
1115 | /* Invalidate status of initial analysis. */ | 1115 | /* Invalidate status of initial analysis. */ |
1116 | private->init_cqr_status = -1; | 1116 | private->init_cqr_status = -1; |
@@ -1161,9 +1161,8 @@ dasd_eckd_check_characteristics(struct dasd_device *device) | |||
1161 | goto out_err3; | 1161 | goto out_err3; |
1162 | 1162 | ||
1163 | /* Read Device Characteristics */ | 1163 | /* Read Device Characteristics */ |
1164 | rdc_data = (void *) &(private->rdc_data); | 1164 | rc = dasd_generic_read_dev_chars(device, "ECKD", &private->rdc_data, |
1165 | memset(rdc_data, 0, sizeof(rdc_data)); | 1165 | 64); |
1166 | rc = dasd_generic_read_dev_chars(device, "ECKD", &rdc_data, 64); | ||
1167 | if (rc) { | 1166 | if (rc) { |
1168 | DBF_EVENT(DBF_WARNING, | 1167 | DBF_EVENT(DBF_WARNING, |
1169 | "Read device characteristics failed, rc=%d for " | 1168 | "Read device characteristics failed, rc=%d for " |
@@ -1183,7 +1182,7 @@ dasd_eckd_check_characteristics(struct dasd_device *device) | |||
1183 | private->rdc_data.dev_model, | 1182 | private->rdc_data.dev_model, |
1184 | private->rdc_data.cu_type, | 1183 | private->rdc_data.cu_type, |
1185 | private->rdc_data.cu_model.model, | 1184 | private->rdc_data.cu_model.model, |
1186 | private->real_cyl, | 1185 | private->real_cyl, |
1187 | private->rdc_data.trk_per_cyl, | 1186 | private->rdc_data.trk_per_cyl, |
1188 | private->rdc_data.sec_per_trk); | 1187 | private->rdc_data.sec_per_trk); |
1189 | return 0; | 1188 | return 0; |