aboutsummaryrefslogtreecommitdiffstats
path: root/sap
diff options
context:
space:
mode:
authorWaldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com>2011-05-31 12:46:50 +0200
committerJohan Hedberg <johan.hedberg@intel.com>2011-06-01 14:47:41 +0300
commit05e51adf10ec4b0e1330cbf557abd118824faa97 (patch)
treeb11e820b9deb1e72ace6660d10e1f0b1ad4ea49e /sap
parentd77b3e021a04ffa8a171565967f29e9f9d5518f3 (diff)
downloadbluez-05e51adf10ec4b0e1330cbf557abd118824faa97.tar.gz
bluez-05e51adf10ec4b0e1330cbf557abd118824faa97.tar.xz
bluez-05e51adf10ec4b0e1330cbf557abd118824faa97.zip
Simplify return value in disconnect_req
Diffstat (limited to 'sap')
-rw-r--r--sap/server.c21
1 files changed, 7 insertions, 14 deletions
diff --git a/sap/server.c b/sap/server.c
index a6712354..d50a2411 100644
--- a/sap/server.c
+++ b/sap/server.c
@@ -349,11 +349,9 @@ static int disconnect_req(struct sap_connection *conn, uint8_t disc_type)
switch (disc_type) {
case SAP_DISCONNECTION_TYPE_GRACEFUL:
- if (conn->state == SAP_STATE_DISCONNECTED)
- goto error_req;
-
- if (conn->state == SAP_STATE_CONNECT_IN_PROGRESS)
- goto error_req;
+ if (conn->state == SAP_STATE_DISCONNECTED ||
+ conn->state == SAP_STATE_CONNECT_IN_PROGRESS)
+ return -EPERM;
if (conn->state == SAP_STATE_CONNECTED) {
conn->state = SAP_STATE_GRACEFUL_DISCONNECT;
@@ -367,11 +365,9 @@ static int disconnect_req(struct sap_connection *conn, uint8_t disc_type)
return 0;
case SAP_DISCONNECTION_TYPE_IMMEDIATE:
- if (conn->state == SAP_STATE_DISCONNECTED)
- goto error_req;
-
- if (conn->state == SAP_STATE_CONNECT_IN_PROGRESS)
- goto error_req;
+ if (conn->state == SAP_STATE_DISCONNECTED ||
+ conn->state == SAP_STATE_CONNECT_IN_PROGRESS)
+ return -EPERM;
if (conn->state == SAP_STATE_CONNECTED ||
conn->state == SAP_STATE_GRACEFUL_DISCONNECT) {
@@ -389,7 +385,7 @@ static int disconnect_req(struct sap_connection *conn, uint8_t disc_type)
if (conn->state != SAP_STATE_CONNECTED &&
conn->state != SAP_STATE_GRACEFUL_DISCONNECT) {
sap_error_rsp(conn);
- goto error_req;
+ return -EPERM;
}
conn->state = SAP_STATE_CLIENT_DISCONNECT;
@@ -404,9 +400,6 @@ static int disconnect_req(struct sap_connection *conn, uint8_t disc_type)
error("Unknown disconnection type (0x%02x).", disc_type);
return -EINVAL;
}
-
-error_req:
- return -EPERM;
}
static void transfer_apdu_req(struct sap_connection *conn,