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 | |
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')
-rw-r--r-- | drivers/s390/block/dasd.c | 4 | ||||
-rw-r--r-- | drivers/s390/block/dasd_eckd.c | 17 | ||||
-rw-r--r-- | drivers/s390/block/dasd_fba.c | 14 | ||||
-rw-r--r-- | drivers/s390/block/dasd_int.h | 2 |
4 files changed, 18 insertions, 19 deletions
diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c index 27a1be0cd4d4..35f43bea5d07 100644 --- a/drivers/s390/block/dasd.c +++ b/drivers/s390/block/dasd.c | |||
@@ -2427,12 +2427,12 @@ static struct dasd_ccw_req *dasd_generic_build_rdc(struct dasd_device *device, | |||
2427 | 2427 | ||
2428 | 2428 | ||
2429 | int dasd_generic_read_dev_chars(struct dasd_device *device, char *magic, | 2429 | int dasd_generic_read_dev_chars(struct dasd_device *device, char *magic, |
2430 | void **rdc_buffer, int rdc_buffer_size) | 2430 | void *rdc_buffer, int rdc_buffer_size) |
2431 | { | 2431 | { |
2432 | int ret; | 2432 | int ret; |
2433 | struct dasd_ccw_req *cqr; | 2433 | struct dasd_ccw_req *cqr; |
2434 | 2434 | ||
2435 | cqr = dasd_generic_build_rdc(device, *rdc_buffer, rdc_buffer_size, | 2435 | cqr = dasd_generic_build_rdc(device, rdc_buffer, rdc_buffer_size, |
2436 | magic); | 2436 | magic); |
2437 | if (IS_ERR(cqr)) | 2437 | if (IS_ERR(cqr)) |
2438 | return PTR_ERR(cqr); | 2438 | return PTR_ERR(cqr); |
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; |
diff --git a/drivers/s390/block/dasd_fba.c b/drivers/s390/block/dasd_fba.c index 8912358daa2f..8c3c8ffbc8bf 100644 --- a/drivers/s390/block/dasd_fba.c +++ b/drivers/s390/block/dasd_fba.c | |||
@@ -122,20 +122,20 @@ dasd_fba_check_characteristics(struct dasd_device *device) | |||
122 | struct dasd_block *block; | 122 | struct dasd_block *block; |
123 | struct dasd_fba_private *private; | 123 | struct dasd_fba_private *private; |
124 | struct ccw_device *cdev = device->cdev; | 124 | struct ccw_device *cdev = device->cdev; |
125 | void *rdc_data; | ||
126 | int rc; | 125 | int rc; |
127 | 126 | ||
128 | private = (struct dasd_fba_private *) device->private; | 127 | private = (struct dasd_fba_private *) device->private; |
129 | if (private == NULL) { | 128 | if (!private) { |
130 | private = kzalloc(sizeof(struct dasd_fba_private), | 129 | private = kzalloc(sizeof(*private), GFP_KERNEL | GFP_DMA); |
131 | GFP_KERNEL | GFP_DMA); | 130 | if (!private) { |
132 | if (private == NULL) { | ||
133 | dev_warn(&device->cdev->dev, | 131 | dev_warn(&device->cdev->dev, |
134 | "Allocating memory for private DASD " | 132 | "Allocating memory for private DASD " |
135 | "data failed\n"); | 133 | "data failed\n"); |
136 | return -ENOMEM; | 134 | return -ENOMEM; |
137 | } | 135 | } |
138 | device->private = (void *) private; | 136 | device->private = (void *) private; |
137 | } else { | ||
138 | memset(private, 0, sizeof(*private)); | ||
139 | } | 139 | } |
140 | block = dasd_alloc_block(); | 140 | block = dasd_alloc_block(); |
141 | if (IS_ERR(block)) { | 141 | if (IS_ERR(block)) { |
@@ -150,8 +150,8 @@ dasd_fba_check_characteristics(struct dasd_device *device) | |||
150 | block->base = device; | 150 | block->base = device; |
151 | 151 | ||
152 | /* Read Device Characteristics */ | 152 | /* Read Device Characteristics */ |
153 | rdc_data = (void *) &(private->rdc_data); | 153 | rc = dasd_generic_read_dev_chars(device, "FBA ", &private->rdc_data, |
154 | rc = dasd_generic_read_dev_chars(device, "FBA ", &rdc_data, 32); | 154 | 32); |
155 | if (rc) { | 155 | if (rc) { |
156 | DBF_EVENT(DBF_WARNING, "Read device characteristics returned " | 156 | DBF_EVENT(DBF_WARNING, "Read device characteristics returned " |
157 | "error %d for device: %s", | 157 | "error %d for device: %s", |
diff --git a/drivers/s390/block/dasd_int.h b/drivers/s390/block/dasd_int.h index c1e487f774c6..3ab69b5a41f6 100644 --- a/drivers/s390/block/dasd_int.h +++ b/drivers/s390/block/dasd_int.h | |||
@@ -578,7 +578,7 @@ int dasd_generic_set_offline (struct ccw_device *cdev); | |||
578 | int dasd_generic_notify(struct ccw_device *, int); | 578 | int dasd_generic_notify(struct ccw_device *, int); |
579 | void dasd_generic_handle_state_change(struct dasd_device *); | 579 | void dasd_generic_handle_state_change(struct dasd_device *); |
580 | 580 | ||
581 | int dasd_generic_read_dev_chars(struct dasd_device *, char *, void **, int); | 581 | int dasd_generic_read_dev_chars(struct dasd_device *, char *, void *, int); |
582 | char *dasd_get_sense(struct irb *); | 582 | char *dasd_get_sense(struct irb *); |
583 | 583 | ||
584 | /* externals in dasd_devmap.c */ | 584 | /* externals in dasd_devmap.c */ |