diff options
author | Jörn Engel <joern@logfs.org> | 2011-11-24 02:05:51 +0100 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2011-12-14 11:28:07 +0000 |
commit | 8359cf43b9dccddeebb0d247146719a14ce6371a (patch) | |
tree | 25421cb0e06d878709a826edf8d724ca102ab441 /drivers/target/iscsi/iscsi_target.c | |
parent | feae85644f1460b3373ef5141183ee43e6191b58 (diff) |
target: remove useless casts
A reader should spend an extra moment whenever noticing a cast,
because either something special is going on that deserves extra
attention or, as is all too often the case, the code is wrong.
These casts, afaics, have all been useless. They cast a foo* to a
foo*, cast a void* to the assigned type, cast a foo* to void*, before
assigning it to a void* variable, etc.
In a few cases I also removed an additional &...[0], which is equally
useless.
Lastly I added three FIXMEs where, to the best of my judgement, the
code appears to have a bug. It would be good if someone could check
these.
Signed-off-by: Joern Engel <joern@logfs.org>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/target/iscsi/iscsi_target.c')
-rw-r--r-- | drivers/target/iscsi/iscsi_target.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c index f74a62d46ee..ac44af165b2 100644 --- a/drivers/target/iscsi/iscsi_target.c +++ b/drivers/target/iscsi/iscsi_target.c @@ -283,8 +283,8 @@ static struct iscsi_np *iscsit_get_np( sock_in6 = (struct sockaddr_in6 *)sockaddr; sock_in6_e = (struct sockaddr_in6 *)&np->np_sockaddr; - if (!memcmp((void *)&sock_in6->sin6_addr.in6_u, - (void *)&sock_in6_e->sin6_addr.in6_u, + if (!memcmp(&sock_in6->sin6_addr.in6_u, + &sock_in6_e->sin6_addr.in6_u, sizeof(struct in6_addr))) ip_match = 1; @@ -1224,7 +1224,7 @@ static void iscsit_do_crypto_hash_buf( crypto_hash_init(hash); - sg_init_one(&sg, (u8 *)buf, payload_length); + sg_init_one(&sg, buf, payload_length); crypto_hash_update(hash, &sg, payload_length); if (padding) { @@ -1602,7 +1602,7 @@ static int iscsit_handle_nop_out( /* * Attach ping data to struct iscsi_cmd->buf_ptr. */ - cmd->buf_ptr = (void *)ping_data; + cmd->buf_ptr = ping_data; cmd->buf_ptr_size = payload_length; pr_debug("Got %u bytes of NOPOUT ping" @@ -3196,7 +3196,7 @@ static int iscsit_build_sendtargets_response(struct iscsi_cmd *cmd) end_of_buf = 1; goto eob; } - memcpy((void *)payload + payload_len, buf, len); + memcpy(payload + payload_len, buf, len); payload_len += len; spin_lock(&tiqn->tiqn_tpg_lock); @@ -3228,7 +3228,7 @@ static int iscsit_build_sendtargets_response(struct iscsi_cmd *cmd) end_of_buf = 1; goto eob; } - memcpy((void *)payload + payload_len, buf, len); + memcpy(payload + payload_len, buf, len); payload_len += len; } spin_unlock(&tpg->tpg_np_lock); @@ -3485,7 +3485,7 @@ int iscsi_target_tx_thread(void *arg) struct iscsi_conn *conn; struct iscsi_queue_req *qr = NULL; struct se_cmd *se_cmd; - struct iscsi_thread_set *ts = (struct iscsi_thread_set *)arg; + struct iscsi_thread_set *ts = arg; /* * Allow ourselves to be interrupted by SIGINT so that a * connection recovery / failure event can be triggered externally. @@ -3774,7 +3774,7 @@ int iscsi_target_rx_thread(void *arg) u8 buffer[ISCSI_HDR_LEN], opcode; u32 checksum = 0, digest = 0; struct iscsi_conn *conn = NULL; - struct iscsi_thread_set *ts = (struct iscsi_thread_set *)arg; + struct iscsi_thread_set *ts = arg; struct kvec iov; /* * Allow ourselves to be interrupted by SIGINT so that a |