Commit 7aeeeb92 authored by Sven Schnelle's avatar Sven Schnelle Committed by Heiko Carstens

s390/raw3270: remove BUG_ON in raw3270_request_reset()

WARN_ON_ONCE if list is not empty, and return an error code
instead.
Signed-off-by: default avatarSven Schnelle <svens@linux.ibm.com>
Acked-by: default avatarHeiko Carstens <hca@linux.ibm.com>
Signed-off-by: default avatarHeiko Carstens <hca@linux.ibm.com>
parent 82df96d8
...@@ -180,15 +180,17 @@ EXPORT_SYMBOL(raw3270_request_free); ...@@ -180,15 +180,17 @@ EXPORT_SYMBOL(raw3270_request_free);
/* /*
* Reset request to initial state. * Reset request to initial state.
*/ */
void raw3270_request_reset(struct raw3270_request *rq) int raw3270_request_reset(struct raw3270_request *rq)
{ {
BUG_ON(!list_empty(&rq->list)); if (WARN_ON_ONCE(!list_empty(&rq->list)))
return -EBUSY;
rq->ccw.cmd_code = 0; rq->ccw.cmd_code = 0;
rq->ccw.count = 0; rq->ccw.count = 0;
rq->ccw.cda = __pa(rq->buffer); rq->ccw.cda = __pa(rq->buffer);
rq->ccw.flags = CCW_FLAG_SLI; rq->ccw.flags = CCW_FLAG_SLI;
rq->rescnt = 0; rq->rescnt = 0;
rq->rc = 0; rq->rc = 0;
return 0;
} }
EXPORT_SYMBOL(raw3270_request_reset); EXPORT_SYMBOL(raw3270_request_reset);
...@@ -289,7 +291,9 @@ int raw3270_start_request(struct raw3270_view *view, struct raw3270_request *rq, ...@@ -289,7 +291,9 @@ int raw3270_start_request(struct raw3270_view *view, struct raw3270_request *rq,
{ {
int rc; int rc;
raw3270_request_reset(rq); rc = raw3270_request_reset(rq);
if (rc)
return rc;
raw3270_request_set_cmd(rq, cmd); raw3270_request_set_cmd(rq, cmd);
rc = raw3270_request_add_data(rq, data, len); rc = raw3270_request_add_data(rq, data, len);
if (rc) if (rc)
......
...@@ -120,7 +120,7 @@ struct raw3270_request { ...@@ -120,7 +120,7 @@ struct raw3270_request {
struct raw3270_request *raw3270_request_alloc(size_t size); struct raw3270_request *raw3270_request_alloc(size_t size);
void raw3270_request_free(struct raw3270_request *rq); void raw3270_request_free(struct raw3270_request *rq);
void raw3270_request_reset(struct raw3270_request *rq); int raw3270_request_reset(struct raw3270_request *rq);
void raw3270_request_set_cmd(struct raw3270_request *rq, u8 cmd); void raw3270_request_set_cmd(struct raw3270_request *rq, u8 cmd);
int raw3270_request_add_data(struct raw3270_request *rq, void *data, size_t size); int raw3270_request_add_data(struct raw3270_request *rq, void *data, size_t size);
void raw3270_request_set_data(struct raw3270_request *rq, void *data, size_t size); void raw3270_request_set_data(struct raw3270_request *rq, void *data, size_t size);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment