diff options
author | Julia Lawall <Julia.Lawall@lip6.fr> | 2012-04-11 08:28:04 -0400 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2012-04-11 08:28:24 -0400 |
commit | cd10502b8276b0486850685383243cbd26d50c8d (patch) | |
tree | aadada6e2334dbea754e25b8370bd32a1049052b | |
parent | 923e9a1399b620d063cd88537c64561bc3d5f905 (diff) |
[S390] drivers/s390/block/dasd_eckd.c: add missing dasd_sfree_request
Extend some error paths to call dasd_sfree_request as done earlier in the
function. The error-handling code is also moved to the end of the function.
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
-rw-r--r-- | drivers/s390/block/dasd_eckd.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/drivers/s390/block/dasd_eckd.c b/drivers/s390/block/dasd_eckd.c index c21871a4e73d..bc2e8a7c265b 100644 --- a/drivers/s390/block/dasd_eckd.c +++ b/drivers/s390/block/dasd_eckd.c | |||
@@ -2844,6 +2844,7 @@ static struct dasd_ccw_req *dasd_eckd_build_cp_tpm_track( | |||
2844 | sector_t recid, trkid; | 2844 | sector_t recid, trkid; |
2845 | unsigned int offs; | 2845 | unsigned int offs; |
2846 | unsigned int count, count_to_trk_end; | 2846 | unsigned int count, count_to_trk_end; |
2847 | int ret; | ||
2847 | 2848 | ||
2848 | basedev = block->base; | 2849 | basedev = block->base; |
2849 | if (rq_data_dir(req) == READ) { | 2850 | if (rq_data_dir(req) == READ) { |
@@ -2884,8 +2885,8 @@ static struct dasd_ccw_req *dasd_eckd_build_cp_tpm_track( | |||
2884 | 2885 | ||
2885 | itcw = itcw_init(cqr->data, itcw_size, itcw_op, 0, ctidaw, 0); | 2886 | itcw = itcw_init(cqr->data, itcw_size, itcw_op, 0, ctidaw, 0); |
2886 | if (IS_ERR(itcw)) { | 2887 | if (IS_ERR(itcw)) { |
2887 | dasd_sfree_request(cqr, startdev); | 2888 | ret = -EINVAL; |
2888 | return ERR_PTR(-EINVAL); | 2889 | goto out_error; |
2889 | } | 2890 | } |
2890 | cqr->cpaddr = itcw_get_tcw(itcw); | 2891 | cqr->cpaddr = itcw_get_tcw(itcw); |
2891 | if (prepare_itcw(itcw, first_trk, last_trk, | 2892 | if (prepare_itcw(itcw, first_trk, last_trk, |
@@ -2897,8 +2898,8 @@ static struct dasd_ccw_req *dasd_eckd_build_cp_tpm_track( | |||
2897 | /* Clock not in sync and XRC is enabled. | 2898 | /* Clock not in sync and XRC is enabled. |
2898 | * Try again later. | 2899 | * Try again later. |
2899 | */ | 2900 | */ |
2900 | dasd_sfree_request(cqr, startdev); | 2901 | ret = -EAGAIN; |
2901 | return ERR_PTR(-EAGAIN); | 2902 | goto out_error; |
2902 | } | 2903 | } |
2903 | len_to_track_end = 0; | 2904 | len_to_track_end = 0; |
2904 | /* | 2905 | /* |
@@ -2937,8 +2938,10 @@ static struct dasd_ccw_req *dasd_eckd_build_cp_tpm_track( | |||
2937 | tidaw_flags = 0; | 2938 | tidaw_flags = 0; |
2938 | last_tidaw = itcw_add_tidaw(itcw, tidaw_flags, | 2939 | last_tidaw = itcw_add_tidaw(itcw, tidaw_flags, |
2939 | dst, part_len); | 2940 | dst, part_len); |
2940 | if (IS_ERR(last_tidaw)) | 2941 | if (IS_ERR(last_tidaw)) { |
2941 | return ERR_PTR(-EINVAL); | 2942 | ret = -EINVAL; |
2943 | goto out_error; | ||
2944 | } | ||
2942 | dst += part_len; | 2945 | dst += part_len; |
2943 | } | 2946 | } |
2944 | } | 2947 | } |
@@ -2947,8 +2950,10 @@ static struct dasd_ccw_req *dasd_eckd_build_cp_tpm_track( | |||
2947 | dst = page_address(bv->bv_page) + bv->bv_offset; | 2950 | dst = page_address(bv->bv_page) + bv->bv_offset; |
2948 | last_tidaw = itcw_add_tidaw(itcw, 0x00, | 2951 | last_tidaw = itcw_add_tidaw(itcw, 0x00, |
2949 | dst, bv->bv_len); | 2952 | dst, bv->bv_len); |
2950 | if (IS_ERR(last_tidaw)) | 2953 | if (IS_ERR(last_tidaw)) { |
2951 | return ERR_PTR(-EINVAL); | 2954 | ret = -EINVAL; |
2955 | goto out_error; | ||
2956 | } | ||
2952 | } | 2957 | } |
2953 | } | 2958 | } |
2954 | last_tidaw->flags |= TIDAW_FLAGS_LAST; | 2959 | last_tidaw->flags |= TIDAW_FLAGS_LAST; |
@@ -2968,6 +2973,9 @@ static struct dasd_ccw_req *dasd_eckd_build_cp_tpm_track( | |||
2968 | cqr->buildclk = get_clock(); | 2973 | cqr->buildclk = get_clock(); |
2969 | cqr->status = DASD_CQR_FILLED; | 2974 | cqr->status = DASD_CQR_FILLED; |
2970 | return cqr; | 2975 | return cqr; |
2976 | out_error: | ||
2977 | dasd_sfree_request(cqr, startdev); | ||
2978 | return ERR_PTR(ret); | ||
2971 | } | 2979 | } |
2972 | 2980 | ||
2973 | static struct dasd_ccw_req *dasd_eckd_build_cp(struct dasd_device *startdev, | 2981 | static struct dasd_ccw_req *dasd_eckd_build_cp(struct dasd_device *startdev, |