Commit 4b2eee35 authored by Julian Wiedmann's avatar Julian Wiedmann Committed by David S. Miller

s390/qeth: cleanup OAT code

While initially just trying to fix up the indentation, condense a few
lines and get rid of a goto label.
Signed-off-by: default avatarJulian Wiedmann <jwi@linux.ibm.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f7ec2d2a
...@@ -4835,17 +4835,17 @@ static int qeth_snmp_command(struct qeth_card *card, char __user *udata) ...@@ -4835,17 +4835,17 @@ static int qeth_snmp_command(struct qeth_card *card, char __user *udata)
} }
static int qeth_setadpparms_query_oat_cb(struct qeth_card *card, static int qeth_setadpparms_query_oat_cb(struct qeth_card *card,
struct qeth_reply *reply, unsigned long data) struct qeth_reply *reply,
unsigned long data)
{ {
struct qeth_ipa_cmd *cmd = (struct qeth_ipa_cmd *)data; struct qeth_ipa_cmd *cmd = (struct qeth_ipa_cmd *)data;
struct qeth_qoat_priv *priv; struct qeth_qoat_priv *priv = reply->param;
int resdatalen; int resdatalen;
QETH_CARD_TEXT(card, 3, "qoatcb"); QETH_CARD_TEXT(card, 3, "qoatcb");
if (qeth_setadpparms_inspect_rc(cmd)) if (qeth_setadpparms_inspect_rc(cmd))
return -EIO; return -EIO;
priv = (struct qeth_qoat_priv *)reply->param;
resdatalen = cmd->data.setadapterparms.hdr.cmdlength; resdatalen = cmd->data.setadapterparms.hdr.cmdlength;
if (resdatalen > (priv->buffer_len - priv->response_len)) if (resdatalen > (priv->buffer_len - priv->response_len))
...@@ -4873,24 +4873,17 @@ static int qeth_query_oat_command(struct qeth_card *card, char __user *udata) ...@@ -4873,24 +4873,17 @@ static int qeth_query_oat_command(struct qeth_card *card, char __user *udata)
QETH_CARD_TEXT(card, 3, "qoatcmd"); QETH_CARD_TEXT(card, 3, "qoatcmd");
if (!qeth_adp_supported(card, IPA_SETADP_QUERY_OAT)) { if (!qeth_adp_supported(card, IPA_SETADP_QUERY_OAT))
rc = -EOPNOTSUPP; return -EOPNOTSUPP;
goto out;
}
if (copy_from_user(&oat_data, udata, if (copy_from_user(&oat_data, udata, sizeof(oat_data)))
sizeof(struct qeth_query_oat_data))) { return -EFAULT;
rc = -EFAULT;
goto out;
}
priv.buffer_len = oat_data.buffer_len; priv.buffer_len = oat_data.buffer_len;
priv.response_len = 0; priv.response_len = 0;
priv.buffer = vzalloc(oat_data.buffer_len); priv.buffer = vzalloc(oat_data.buffer_len);
if (!priv.buffer) { if (!priv.buffer)
rc = -ENOMEM; return -ENOMEM;
goto out;
}
iob = qeth_get_adapter_cmd(card, IPA_SETADP_QUERY_OAT, iob = qeth_get_adapter_cmd(card, IPA_SETADP_QUERY_OAT,
SETADP_DATA_SIZEOF(query_oat)); SETADP_DATA_SIZEOF(query_oat));
...@@ -4902,28 +4895,19 @@ static int qeth_query_oat_command(struct qeth_card *card, char __user *udata) ...@@ -4902,28 +4895,19 @@ static int qeth_query_oat_command(struct qeth_card *card, char __user *udata)
oat_req = &cmd->data.setadapterparms.data.query_oat; oat_req = &cmd->data.setadapterparms.data.query_oat;
oat_req->subcmd_code = oat_data.command; oat_req->subcmd_code = oat_data.command;
rc = qeth_send_ipa_cmd(card, iob, qeth_setadpparms_query_oat_cb, rc = qeth_send_ipa_cmd(card, iob, qeth_setadpparms_query_oat_cb, &priv);
&priv);
if (!rc) { if (!rc) {
tmp = is_compat_task() ? compat_ptr(oat_data.ptr) : tmp = is_compat_task() ? compat_ptr(oat_data.ptr) :
u64_to_user_ptr(oat_data.ptr); u64_to_user_ptr(oat_data.ptr);
if (copy_to_user(tmp, priv.buffer,
priv.response_len)) {
rc = -EFAULT;
goto out_free;
}
oat_data.response_len = priv.response_len; oat_data.response_len = priv.response_len;
if (copy_to_user(udata, &oat_data, if (copy_to_user(tmp, priv.buffer, priv.response_len) ||
sizeof(struct qeth_query_oat_data))) copy_to_user(udata, &oat_data, sizeof(oat_data)))
rc = -EFAULT; rc = -EFAULT;
} }
out_free: out_free:
vfree(priv.buffer); vfree(priv.buffer);
out:
return rc; return rc;
} }
......
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