Commit 8359cf43b9dccddeebb0d247146719a14ce6371a
Committed by
Nicholas Bellinger
1 parent
feae85644f
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
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>
Showing 18 changed files with 90 additions and 101 deletions Side-by-side Diff
- drivers/target/iscsi/iscsi_target.c
- drivers/target/iscsi/iscsi_target_auth.c
- drivers/target/iscsi/iscsi_target_configfs.c
- drivers/target/iscsi/iscsi_target_login.c
- drivers/target/iscsi/iscsi_target_nego.c
- drivers/target/iscsi/iscsi_target_nodeattrib.c
- drivers/target/iscsi/iscsi_target_stat.c
- drivers/target/iscsi/iscsi_target_tpg.c
- drivers/target/iscsi/iscsi_target_util.c
- drivers/target/loopback/tcm_loop.c
- drivers/target/target_core_cdb.c
- drivers/target/target_core_configfs.c
- drivers/target/target_core_fabric_lib.c
- drivers/target/target_core_file.c
- drivers/target/target_core_iblock.c
- drivers/target/target_core_pscsi.c
- drivers/target/target_core_stat.c
- drivers/target/target_core_transport.c
drivers/target/iscsi/iscsi_target.c
... | ... | @@ -283,8 +283,8 @@ |
283 | 283 | sock_in6 = (struct sockaddr_in6 *)sockaddr; |
284 | 284 | sock_in6_e = (struct sockaddr_in6 *)&np->np_sockaddr; |
285 | 285 | |
286 | - if (!memcmp((void *)&sock_in6->sin6_addr.in6_u, | |
287 | - (void *)&sock_in6_e->sin6_addr.in6_u, | |
286 | + if (!memcmp(&sock_in6->sin6_addr.in6_u, | |
287 | + &sock_in6_e->sin6_addr.in6_u, | |
288 | 288 | sizeof(struct in6_addr))) |
289 | 289 | ip_match = 1; |
290 | 290 | |
... | ... | @@ -1224,7 +1224,7 @@ |
1224 | 1224 | |
1225 | 1225 | crypto_hash_init(hash); |
1226 | 1226 | |
1227 | - sg_init_one(&sg, (u8 *)buf, payload_length); | |
1227 | + sg_init_one(&sg, buf, payload_length); | |
1228 | 1228 | crypto_hash_update(hash, &sg, payload_length); |
1229 | 1229 | |
1230 | 1230 | if (padding) { |
... | ... | @@ -1602,7 +1602,7 @@ |
1602 | 1602 | /* |
1603 | 1603 | * Attach ping data to struct iscsi_cmd->buf_ptr. |
1604 | 1604 | */ |
1605 | - cmd->buf_ptr = (void *)ping_data; | |
1605 | + cmd->buf_ptr = ping_data; | |
1606 | 1606 | cmd->buf_ptr_size = payload_length; |
1607 | 1607 | |
1608 | 1608 | pr_debug("Got %u bytes of NOPOUT ping" |
... | ... | @@ -3196,7 +3196,7 @@ |
3196 | 3196 | end_of_buf = 1; |
3197 | 3197 | goto eob; |
3198 | 3198 | } |
3199 | - memcpy((void *)payload + payload_len, buf, len); | |
3199 | + memcpy(payload + payload_len, buf, len); | |
3200 | 3200 | payload_len += len; |
3201 | 3201 | |
3202 | 3202 | spin_lock(&tiqn->tiqn_tpg_lock); |
... | ... | @@ -3228,7 +3228,7 @@ |
3228 | 3228 | end_of_buf = 1; |
3229 | 3229 | goto eob; |
3230 | 3230 | } |
3231 | - memcpy((void *)payload + payload_len, buf, len); | |
3231 | + memcpy(payload + payload_len, buf, len); | |
3232 | 3232 | payload_len += len; |
3233 | 3233 | } |
3234 | 3234 | spin_unlock(&tpg->tpg_np_lock); |
... | ... | @@ -3485,7 +3485,7 @@ |
3485 | 3485 | struct iscsi_conn *conn; |
3486 | 3486 | struct iscsi_queue_req *qr = NULL; |
3487 | 3487 | struct se_cmd *se_cmd; |
3488 | - struct iscsi_thread_set *ts = (struct iscsi_thread_set *)arg; | |
3488 | + struct iscsi_thread_set *ts = arg; | |
3489 | 3489 | /* |
3490 | 3490 | * Allow ourselves to be interrupted by SIGINT so that a |
3491 | 3491 | * connection recovery / failure event can be triggered externally. |
... | ... | @@ -3774,7 +3774,7 @@ |
3774 | 3774 | u8 buffer[ISCSI_HDR_LEN], opcode; |
3775 | 3775 | u32 checksum = 0, digest = 0; |
3776 | 3776 | struct iscsi_conn *conn = NULL; |
3777 | - struct iscsi_thread_set *ts = (struct iscsi_thread_set *)arg; | |
3777 | + struct iscsi_thread_set *ts = arg; | |
3778 | 3778 | struct kvec iov; |
3779 | 3779 | /* |
3780 | 3780 | * Allow ourselves to be interrupted by SIGINT so that a |
drivers/target/iscsi/iscsi_target_auth.c
... | ... | @@ -82,7 +82,7 @@ |
82 | 82 | unsigned int *c_len) |
83 | 83 | { |
84 | 84 | unsigned char challenge_asciihex[CHAP_CHALLENGE_LENGTH * 2 + 1]; |
85 | - struct iscsi_chap *chap = (struct iscsi_chap *) conn->auth_protocol; | |
85 | + struct iscsi_chap *chap = conn->auth_protocol; | |
86 | 86 | |
87 | 87 | memset(challenge_asciihex, 0, CHAP_CHALLENGE_LENGTH * 2 + 1); |
88 | 88 | |
... | ... | @@ -120,7 +120,7 @@ |
120 | 120 | if (!conn->auth_protocol) |
121 | 121 | return NULL; |
122 | 122 | |
123 | - chap = (struct iscsi_chap *) conn->auth_protocol; | |
123 | + chap = conn->auth_protocol; | |
124 | 124 | /* |
125 | 125 | * We only support MD5 MDA presently. |
126 | 126 | */ |
... | ... | @@ -172,7 +172,7 @@ |
172 | 172 | unsigned char client_digest[MD5_SIGNATURE_SIZE]; |
173 | 173 | unsigned char server_digest[MD5_SIGNATURE_SIZE]; |
174 | 174 | unsigned char chap_n[MAX_CHAP_N_SIZE], chap_r[MAX_RESPONSE_LENGTH]; |
175 | - struct iscsi_chap *chap = (struct iscsi_chap *) conn->auth_protocol; | |
175 | + struct iscsi_chap *chap = conn->auth_protocol; | |
176 | 176 | struct crypto_hash *tfm; |
177 | 177 | struct hash_desc desc; |
178 | 178 | struct scatterlist sg; |
... | ... | @@ -246,7 +246,7 @@ |
246 | 246 | goto out; |
247 | 247 | } |
248 | 248 | |
249 | - sg_init_one(&sg, (void *)&chap->id, 1); | |
249 | + sg_init_one(&sg, &chap->id, 1); | |
250 | 250 | ret = crypto_hash_update(&desc, &sg, 1); |
251 | 251 | if (ret < 0) { |
252 | 252 | pr_err("crypto_hash_update() failed for id\n"); |
... | ... | @@ -254,7 +254,7 @@ |
254 | 254 | goto out; |
255 | 255 | } |
256 | 256 | |
257 | - sg_init_one(&sg, (void *)&auth->password, strlen(auth->password)); | |
257 | + sg_init_one(&sg, &auth->password, strlen(auth->password)); | |
258 | 258 | ret = crypto_hash_update(&desc, &sg, strlen(auth->password)); |
259 | 259 | if (ret < 0) { |
260 | 260 | pr_err("crypto_hash_update() failed for password\n"); |
... | ... | @@ -262,7 +262,7 @@ |
262 | 262 | goto out; |
263 | 263 | } |
264 | 264 | |
265 | - sg_init_one(&sg, (void *)chap->challenge, CHAP_CHALLENGE_LENGTH); | |
265 | + sg_init_one(&sg, chap->challenge, CHAP_CHALLENGE_LENGTH); | |
266 | 266 | ret = crypto_hash_update(&desc, &sg, CHAP_CHALLENGE_LENGTH); |
267 | 267 | if (ret < 0) { |
268 | 268 | pr_err("crypto_hash_update() failed for challenge\n"); |
269 | 269 | |
270 | 270 | |
... | ... | @@ -304,11 +304,11 @@ |
304 | 304 | goto out; |
305 | 305 | } |
306 | 306 | |
307 | + /* FIXME: What happens when simple_strtoul() return 256, 257, etc.? */ | |
307 | 308 | if (type == HEX) |
308 | - id = (unsigned char)simple_strtoul((char *)&identifier[2], | |
309 | - &endptr, 0); | |
309 | + id = simple_strtoul(&identifier[2], &endptr, 0); | |
310 | 310 | else |
311 | - id = (unsigned char)simple_strtoul(identifier, &endptr, 0); | |
311 | + id = simple_strtoul(identifier, &endptr, 0); | |
312 | 312 | /* |
313 | 313 | * RFC 1994 says Identifier is no more than octet (8 bits). |
314 | 314 | */ |
... | ... | @@ -351,7 +351,7 @@ |
351 | 351 | goto out; |
352 | 352 | } |
353 | 353 | |
354 | - sg_init_one(&sg, (void *)&id, 1); | |
354 | + sg_init_one(&sg, &id, 1); | |
355 | 355 | ret = crypto_hash_update(&desc, &sg, 1); |
356 | 356 | if (ret < 0) { |
357 | 357 | pr_err("crypto_hash_update() failed for id\n"); |
... | ... | @@ -359,7 +359,7 @@ |
359 | 359 | goto out; |
360 | 360 | } |
361 | 361 | |
362 | - sg_init_one(&sg, (void *)auth->password_mutual, | |
362 | + sg_init_one(&sg, auth->password_mutual, | |
363 | 363 | strlen(auth->password_mutual)); |
364 | 364 | ret = crypto_hash_update(&desc, &sg, strlen(auth->password_mutual)); |
365 | 365 | if (ret < 0) { |
... | ... | @@ -371,7 +371,7 @@ |
371 | 371 | /* |
372 | 372 | * Convert received challenge to binary hex. |
373 | 373 | */ |
374 | - sg_init_one(&sg, (void *)challenge_binhex, challenge_len); | |
374 | + sg_init_one(&sg, challenge_binhex, challenge_len); | |
375 | 375 | ret = crypto_hash_update(&desc, &sg, challenge_len); |
376 | 376 | if (ret < 0) { |
377 | 377 | pr_err("crypto_hash_update() failed for ma challenge\n"); |
... | ... | @@ -414,7 +414,7 @@ |
414 | 414 | char *nr_out_ptr, |
415 | 415 | unsigned int *nr_out_len) |
416 | 416 | { |
417 | - struct iscsi_chap *chap = (struct iscsi_chap *) conn->auth_protocol; | |
417 | + struct iscsi_chap *chap = conn->auth_protocol; | |
418 | 418 | |
419 | 419 | switch (chap->digest_type) { |
420 | 420 | case CHAP_DIGEST_MD5: |
... | ... | @@ -437,7 +437,7 @@ |
437 | 437 | int *in_len, |
438 | 438 | int *out_len) |
439 | 439 | { |
440 | - struct iscsi_chap *chap = (struct iscsi_chap *) conn->auth_protocol; | |
440 | + struct iscsi_chap *chap = conn->auth_protocol; | |
441 | 441 | |
442 | 442 | if (!chap) { |
443 | 443 | chap = chap_server_open(conn, auth, in_text, out_text, out_len); |
drivers/target/iscsi/iscsi_target_configfs.c
... | ... | @@ -52,8 +52,7 @@ |
52 | 52 | { |
53 | 53 | struct se_portal_group *se_tpg = container_of(to_config_group(item), |
54 | 54 | struct se_portal_group, tpg_group); |
55 | - struct iscsi_portal_group *tpg = | |
56 | - (struct iscsi_portal_group *)se_tpg->se_tpg_fabric_ptr; | |
55 | + struct iscsi_portal_group *tpg = se_tpg->se_tpg_fabric_ptr; | |
57 | 56 | int ret; |
58 | 57 | |
59 | 58 | if (!tpg) { |
... | ... | @@ -1221,7 +1220,7 @@ |
1221 | 1220 | |
1222 | 1221 | ret = core_tpg_register( |
1223 | 1222 | &lio_target_fabric_configfs->tf_ops, |
1224 | - wwn, &tpg->tpg_se_tpg, (void *)tpg, | |
1223 | + wwn, &tpg->tpg_se_tpg, tpg, | |
1225 | 1224 | TRANSPORT_TPG_TYPE_NORMAL); |
1226 | 1225 | if (ret < 0) |
1227 | 1226 | return NULL; |
drivers/target/iscsi/iscsi_target_login.c
... | ... | @@ -143,7 +143,7 @@ |
143 | 143 | list_for_each_entry_safe(se_sess, se_sess_tmp, &se_tpg->tpg_sess_list, |
144 | 144 | sess_list) { |
145 | 145 | |
146 | - sess_p = (struct iscsi_session *)se_sess->fabric_sess_ptr; | |
146 | + sess_p = se_sess->fabric_sess_ptr; | |
147 | 147 | spin_lock(&sess_p->conn_lock); |
148 | 148 | if (atomic_read(&sess_p->session_fall_back_to_erl0) || |
149 | 149 | atomic_read(&sess_p->session_logout) || |
... | ... | @@ -151,9 +151,9 @@ |
151 | 151 | spin_unlock(&sess_p->conn_lock); |
152 | 152 | continue; |
153 | 153 | } |
154 | - if (!memcmp((void *)sess_p->isid, (void *)conn->sess->isid, 6) && | |
155 | - (!strcmp((void *)sess_p->sess_ops->InitiatorName, | |
156 | - (void *)initiatorname_param->value) && | |
154 | + if (!memcmp(sess_p->isid, conn->sess->isid, 6) && | |
155 | + (!strcmp(sess_p->sess_ops->InitiatorName, | |
156 | + initiatorname_param->value) && | |
157 | 157 | (sess_p->sess_ops->SessionType == sessiontype))) { |
158 | 158 | atomic_set(&sess_p->session_reinstatement, 1); |
159 | 159 | spin_unlock(&sess_p->conn_lock); |
... | ... | @@ -229,7 +229,7 @@ |
229 | 229 | |
230 | 230 | iscsi_login_set_conn_values(sess, conn, pdu->cid); |
231 | 231 | sess->init_task_tag = pdu->itt; |
232 | - memcpy((void *)&sess->isid, (void *)pdu->isid, 6); | |
232 | + memcpy(&sess->isid, pdu->isid, 6); | |
233 | 233 | sess->exp_cmd_sn = pdu->cmdsn; |
234 | 234 | INIT_LIST_HEAD(&sess->sess_conn_list); |
235 | 235 | INIT_LIST_HEAD(&sess->sess_ooo_cmdsn_list); |
... | ... | @@ -440,8 +440,7 @@ |
440 | 440 | atomic_read(&sess_p->session_logout) || |
441 | 441 | (sess_p->time2retain_timer_flags & ISCSI_TF_EXPIRED)) |
442 | 442 | continue; |
443 | - if (!memcmp((const void *)sess_p->isid, | |
444 | - (const void *)pdu->isid, 6) && | |
443 | + if (!memcmp(sess_p->isid, pdu->isid, 6) && | |
445 | 444 | (sess_p->tsih == pdu->tsih)) { |
446 | 445 | iscsit_inc_session_usage_count(sess_p); |
447 | 446 | iscsit_stop_time2retain_timer(sess_p); |
... | ... | @@ -654,7 +653,7 @@ |
654 | 653 | |
655 | 654 | spin_lock_bh(&se_tpg->session_lock); |
656 | 655 | __transport_register_session(&sess->tpg->tpg_se_tpg, |
657 | - se_sess->se_node_acl, se_sess, (void *)sess); | |
656 | + se_sess->se_node_acl, se_sess, sess); | |
658 | 657 | pr_debug("Moving to TARG_SESS_STATE_LOGGED_IN.\n"); |
659 | 658 | sess->session_state = TARG_SESS_STATE_LOGGED_IN; |
660 | 659 | |
... | ... | @@ -811,7 +810,7 @@ |
811 | 810 | * Setup the np->np_sockaddr from the passed sockaddr setup |
812 | 811 | * in iscsi_target_configfs.c code.. |
813 | 812 | */ |
814 | - memcpy((void *)&np->np_sockaddr, (void *)sockaddr, | |
813 | + memcpy(&np->np_sockaddr, sockaddr, | |
815 | 814 | sizeof(struct __kernel_sockaddr_storage)); |
816 | 815 | |
817 | 816 | if (sockaddr->ss_family == AF_INET6) |
... | ... | @@ -821,6 +820,7 @@ |
821 | 820 | /* |
822 | 821 | * Set SO_REUSEADDR, and disable Nagel Algorithm with TCP_NODELAY. |
823 | 822 | */ |
823 | + /* FIXME: Someone please explain why this is endian-safe */ | |
824 | 824 | opt = 1; |
825 | 825 | if (np->np_network_transport == ISCSI_TCP) { |
826 | 826 | ret = kernel_setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, |
... | ... | @@ -832,6 +832,7 @@ |
832 | 832 | } |
833 | 833 | } |
834 | 834 | |
835 | + /* FIXME: Someone please explain why this is endian-safe */ | |
835 | 836 | ret = kernel_setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, |
836 | 837 | (char *)&opt, sizeof(opt)); |
837 | 838 | if (ret < 0) { |
... | ... | @@ -1206,7 +1207,7 @@ |
1206 | 1207 | |
1207 | 1208 | int iscsi_target_login_thread(void *arg) |
1208 | 1209 | { |
1209 | - struct iscsi_np *np = (struct iscsi_np *)arg; | |
1210 | + struct iscsi_np *np = arg; | |
1210 | 1211 | int ret; |
1211 | 1212 | |
1212 | 1213 | allow_signal(SIGINT); |
drivers/target/iscsi/iscsi_target_nego.c
drivers/target/iscsi/iscsi_target_nodeattrib.c
... | ... | @@ -134,7 +134,7 @@ |
134 | 134 | spin_lock_bh(&se_nacl->nacl_sess_lock); |
135 | 135 | se_sess = se_nacl->nacl_sess; |
136 | 136 | if (se_sess) { |
137 | - sess = (struct iscsi_session *)se_sess->fabric_sess_ptr; | |
137 | + sess = se_sess->fabric_sess_ptr; | |
138 | 138 | |
139 | 139 | spin_lock(&sess->conn_lock); |
140 | 140 | list_for_each_entry(conn, &sess->sess_conn_list, |
drivers/target/iscsi/iscsi_target_stat.c
... | ... | @@ -745,7 +745,7 @@ |
745 | 745 | spin_lock_bh(&se_nacl->nacl_sess_lock); |
746 | 746 | se_sess = se_nacl->nacl_sess; |
747 | 747 | if (se_sess) { |
748 | - sess = (struct iscsi_session *)se_sess->fabric_sess_ptr; | |
748 | + sess = se_sess->fabric_sess_ptr; | |
749 | 749 | if (sess) |
750 | 750 | ret = snprintf(page, PAGE_SIZE, "%u\n", |
751 | 751 | sess->sess_ops->SessionType ? 0 : ISCSI_NODE_INDEX); |
... | ... | @@ -769,7 +769,7 @@ |
769 | 769 | spin_lock_bh(&se_nacl->nacl_sess_lock); |
770 | 770 | se_sess = se_nacl->nacl_sess; |
771 | 771 | if (se_sess) { |
772 | - sess = (struct iscsi_session *)se_sess->fabric_sess_ptr; | |
772 | + sess = se_sess->fabric_sess_ptr; | |
773 | 773 | if (sess) |
774 | 774 | ret = snprintf(page, PAGE_SIZE, "%u\n", |
775 | 775 | sess->session_index); |
... | ... | @@ -793,7 +793,7 @@ |
793 | 793 | spin_lock_bh(&se_nacl->nacl_sess_lock); |
794 | 794 | se_sess = se_nacl->nacl_sess; |
795 | 795 | if (se_sess) { |
796 | - sess = (struct iscsi_session *)se_sess->fabric_sess_ptr; | |
796 | + sess = se_sess->fabric_sess_ptr; | |
797 | 797 | if (sess) |
798 | 798 | ret = snprintf(page, PAGE_SIZE, "%u\n", sess->cmd_pdus); |
799 | 799 | } |
... | ... | @@ -816,7 +816,7 @@ |
816 | 816 | spin_lock_bh(&se_nacl->nacl_sess_lock); |
817 | 817 | se_sess = se_nacl->nacl_sess; |
818 | 818 | if (se_sess) { |
819 | - sess = (struct iscsi_session *)se_sess->fabric_sess_ptr; | |
819 | + sess = se_sess->fabric_sess_ptr; | |
820 | 820 | if (sess) |
821 | 821 | ret = snprintf(page, PAGE_SIZE, "%u\n", sess->rsp_pdus); |
822 | 822 | } |
... | ... | @@ -839,7 +839,7 @@ |
839 | 839 | spin_lock_bh(&se_nacl->nacl_sess_lock); |
840 | 840 | se_sess = se_nacl->nacl_sess; |
841 | 841 | if (se_sess) { |
842 | - sess = (struct iscsi_session *)se_sess->fabric_sess_ptr; | |
842 | + sess = se_sess->fabric_sess_ptr; | |
843 | 843 | if (sess) |
844 | 844 | ret = snprintf(page, PAGE_SIZE, "%llu\n", |
845 | 845 | (unsigned long long)sess->tx_data_octets); |
... | ... | @@ -863,7 +863,7 @@ |
863 | 863 | spin_lock_bh(&se_nacl->nacl_sess_lock); |
864 | 864 | se_sess = se_nacl->nacl_sess; |
865 | 865 | if (se_sess) { |
866 | - sess = (struct iscsi_session *)se_sess->fabric_sess_ptr; | |
866 | + sess = se_sess->fabric_sess_ptr; | |
867 | 867 | if (sess) |
868 | 868 | ret = snprintf(page, PAGE_SIZE, "%llu\n", |
869 | 869 | (unsigned long long)sess->rx_data_octets); |
... | ... | @@ -887,7 +887,7 @@ |
887 | 887 | spin_lock_bh(&se_nacl->nacl_sess_lock); |
888 | 888 | se_sess = se_nacl->nacl_sess; |
889 | 889 | if (se_sess) { |
890 | - sess = (struct iscsi_session *)se_sess->fabric_sess_ptr; | |
890 | + sess = se_sess->fabric_sess_ptr; | |
891 | 891 | if (sess) |
892 | 892 | ret = snprintf(page, PAGE_SIZE, "%u\n", |
893 | 893 | sess->conn_digest_errors); |
... | ... | @@ -911,7 +911,7 @@ |
911 | 911 | spin_lock_bh(&se_nacl->nacl_sess_lock); |
912 | 912 | se_sess = se_nacl->nacl_sess; |
913 | 913 | if (se_sess) { |
914 | - sess = (struct iscsi_session *)se_sess->fabric_sess_ptr; | |
914 | + sess = se_sess->fabric_sess_ptr; | |
915 | 915 | if (sess) |
916 | 916 | ret = snprintf(page, PAGE_SIZE, "%u\n", |
917 | 917 | sess->conn_timeout_errors); |
drivers/target/iscsi/iscsi_target_tpg.c
drivers/target/iscsi/iscsi_target_util.c
... | ... | @@ -287,7 +287,7 @@ |
287 | 287 | } |
288 | 288 | |
289 | 289 | se_cmd->se_tmr_req = core_tmr_alloc_req(se_cmd, |
290 | - (void *)cmd->tmr_req, tcm_function, | |
290 | + cmd->tmr_req, tcm_function, | |
291 | 291 | GFP_KERNEL); |
292 | 292 | if (!se_cmd->se_tmr_req) |
293 | 293 | goto out; |
... | ... | @@ -1064,7 +1064,7 @@ |
1064 | 1064 | if (tiqn) { |
1065 | 1065 | spin_lock_bh(&tiqn->sess_err_stats.lock); |
1066 | 1066 | strcpy(tiqn->sess_err_stats.last_sess_fail_rem_name, |
1067 | - (void *)conn->sess->sess_ops->InitiatorName); | |
1067 | + conn->sess->sess_ops->InitiatorName); | |
1068 | 1068 | tiqn->sess_err_stats.last_sess_failure_type = |
1069 | 1069 | ISCSI_SESS_ERR_CXN_TIMEOUT; |
1070 | 1070 | tiqn->sess_err_stats.cxn_timeout_errors++; |
drivers/target/loopback/tcm_loop.c
... | ... | @@ -559,8 +559,7 @@ |
559 | 559 | |
560 | 560 | static u8 tcm_loop_get_fabric_proto_ident(struct se_portal_group *se_tpg) |
561 | 561 | { |
562 | - struct tcm_loop_tpg *tl_tpg = | |
563 | - (struct tcm_loop_tpg *)se_tpg->se_tpg_fabric_ptr; | |
562 | + struct tcm_loop_tpg *tl_tpg = se_tpg->se_tpg_fabric_ptr; | |
564 | 563 | struct tcm_loop_hba *tl_hba = tl_tpg->tl_hba; |
565 | 564 | /* |
566 | 565 | * tl_proto_id is set at tcm_loop_configfs.c:tcm_loop_make_scsi_hba() |
... | ... | @@ -587,8 +586,7 @@ |
587 | 586 | |
588 | 587 | static char *tcm_loop_get_endpoint_wwn(struct se_portal_group *se_tpg) |
589 | 588 | { |
590 | - struct tcm_loop_tpg *tl_tpg = | |
591 | - (struct tcm_loop_tpg *)se_tpg->se_tpg_fabric_ptr; | |
589 | + struct tcm_loop_tpg *tl_tpg = se_tpg->se_tpg_fabric_ptr; | |
592 | 590 | /* |
593 | 591 | * Return the passed NAA identifier for the SAS Target Port |
594 | 592 | */ |
... | ... | @@ -597,8 +595,7 @@ |
597 | 595 | |
598 | 596 | static u16 tcm_loop_get_tag(struct se_portal_group *se_tpg) |
599 | 597 | { |
600 | - struct tcm_loop_tpg *tl_tpg = | |
601 | - (struct tcm_loop_tpg *)se_tpg->se_tpg_fabric_ptr; | |
598 | + struct tcm_loop_tpg *tl_tpg = se_tpg->se_tpg_fabric_ptr; | |
602 | 599 | /* |
603 | 600 | * This Tag is used when forming SCSI Name identifier in EVPD=1 0x83 |
604 | 601 | * to represent the SCSI Target Port. |
... | ... | @@ -618,8 +615,7 @@ |
618 | 615 | int *format_code, |
619 | 616 | unsigned char *buf) |
620 | 617 | { |
621 | - struct tcm_loop_tpg *tl_tpg = | |
622 | - (struct tcm_loop_tpg *)se_tpg->se_tpg_fabric_ptr; | |
618 | + struct tcm_loop_tpg *tl_tpg = se_tpg->se_tpg_fabric_ptr; | |
623 | 619 | struct tcm_loop_hba *tl_hba = tl_tpg->tl_hba; |
624 | 620 | |
625 | 621 | switch (tl_hba->tl_proto_id) { |
... | ... | @@ -648,8 +644,7 @@ |
648 | 644 | struct t10_pr_registration *pr_reg, |
649 | 645 | int *format_code) |
650 | 646 | { |
651 | - struct tcm_loop_tpg *tl_tpg = | |
652 | - (struct tcm_loop_tpg *)se_tpg->se_tpg_fabric_ptr; | |
647 | + struct tcm_loop_tpg *tl_tpg = se_tpg->se_tpg_fabric_ptr; | |
653 | 648 | struct tcm_loop_hba *tl_hba = tl_tpg->tl_hba; |
654 | 649 | |
655 | 650 | switch (tl_hba->tl_proto_id) { |
... | ... | @@ -682,8 +677,7 @@ |
682 | 677 | u32 *out_tid_len, |
683 | 678 | char **port_nexus_ptr) |
684 | 679 | { |
685 | - struct tcm_loop_tpg *tl_tpg = | |
686 | - (struct tcm_loop_tpg *)se_tpg->se_tpg_fabric_ptr; | |
680 | + struct tcm_loop_tpg *tl_tpg = se_tpg->se_tpg_fabric_ptr; | |
687 | 681 | struct tcm_loop_hba *tl_hba = tl_tpg->tl_hba; |
688 | 682 | |
689 | 683 | switch (tl_hba->tl_proto_id) { |
drivers/target/target_core_cdb.c
... | ... | @@ -116,11 +116,9 @@ |
116 | 116 | goto out; |
117 | 117 | } |
118 | 118 | |
119 | - snprintf((unsigned char *)&buf[8], 8, "LIO-ORG"); | |
120 | - snprintf((unsigned char *)&buf[16], 16, "%s", | |
121 | - &dev->se_sub_dev->t10_wwn.model[0]); | |
122 | - snprintf((unsigned char *)&buf[32], 4, "%s", | |
123 | - &dev->se_sub_dev->t10_wwn.revision[0]); | |
119 | + snprintf(&buf[8], 8, "LIO-ORG"); | |
120 | + snprintf(&buf[16], 16, "%s", dev->se_sub_dev->t10_wwn.model); | |
121 | + snprintf(&buf[32], 4, "%s", dev->se_sub_dev->t10_wwn.revision); | |
124 | 122 | buf[4] = 31; /* Set additional length to 31 */ |
125 | 123 | |
126 | 124 | out: |
... | ... | @@ -139,8 +137,7 @@ |
139 | 137 | SDF_EMULATED_VPD_UNIT_SERIAL) { |
140 | 138 | u32 unit_serial_len; |
141 | 139 | |
142 | - unit_serial_len = | |
143 | - strlen(&dev->se_sub_dev->t10_wwn.unit_serial[0]); | |
140 | + unit_serial_len = strlen(dev->se_sub_dev->t10_wwn.unit_serial); | |
144 | 141 | unit_serial_len++; /* For NULL Terminator */ |
145 | 142 | |
146 | 143 | if (((len + 4) + unit_serial_len) > cmd->data_length) { |
... | ... | @@ -149,8 +146,8 @@ |
149 | 146 | buf[3] = (len & 0xff); |
150 | 147 | return 0; |
151 | 148 | } |
152 | - len += sprintf((unsigned char *)&buf[4], "%s", | |
153 | - &dev->se_sub_dev->t10_wwn.unit_serial[0]); | |
149 | + len += sprintf(&buf[4], "%s", | |
150 | + dev->se_sub_dev->t10_wwn.unit_serial); | |
154 | 151 | len++; /* Extra Byte for NULL Terminator */ |
155 | 152 | buf[3] = len; |
156 | 153 | } |
157 | 154 | |
... | ... | @@ -280,14 +277,13 @@ |
280 | 277 | len += (prod_len + unit_serial_len); |
281 | 278 | goto check_port; |
282 | 279 | } |
283 | - id_len += sprintf((unsigned char *)&buf[off+12], | |
284 | - "%s:%s", prod, | |
280 | + id_len += sprintf(&buf[off+12], "%s:%s", prod, | |
285 | 281 | &dev->se_sub_dev->t10_wwn.unit_serial[0]); |
286 | 282 | } |
287 | 283 | buf[off] = 0x2; /* ASCII */ |
288 | 284 | buf[off+1] = 0x1; /* T10 Vendor ID */ |
289 | 285 | buf[off+2] = 0x0; |
290 | - memcpy((unsigned char *)&buf[off+4], "LIO-ORG", 8); | |
286 | + memcpy(&buf[off+4], "LIO-ORG", 8); | |
291 | 287 | /* Extra Byte for NULL Terminator */ |
292 | 288 | id_len++; |
293 | 289 | /* Identifier Length */ |
drivers/target/target_core_configfs.c
... | ... | @@ -1629,7 +1629,7 @@ |
1629 | 1629 | |
1630 | 1630 | static ssize_t target_core_show_dev_info(void *p, char *page) |
1631 | 1631 | { |
1632 | - struct se_subsystem_dev *se_dev = (struct se_subsystem_dev *)p; | |
1632 | + struct se_subsystem_dev *se_dev = p; | |
1633 | 1633 | struct se_hba *hba = se_dev->se_dev_hba; |
1634 | 1634 | struct se_subsystem_api *t = hba->transport; |
1635 | 1635 | int bl = 0; |
... | ... | @@ -1657,7 +1657,7 @@ |
1657 | 1657 | const char *page, |
1658 | 1658 | size_t count) |
1659 | 1659 | { |
1660 | - struct se_subsystem_dev *se_dev = (struct se_subsystem_dev *)p; | |
1660 | + struct se_subsystem_dev *se_dev = p; | |
1661 | 1661 | struct se_hba *hba = se_dev->se_dev_hba; |
1662 | 1662 | struct se_subsystem_api *t = hba->transport; |
1663 | 1663 | |
... | ... | @@ -1680,7 +1680,7 @@ |
1680 | 1680 | |
1681 | 1681 | static ssize_t target_core_show_dev_alias(void *p, char *page) |
1682 | 1682 | { |
1683 | - struct se_subsystem_dev *se_dev = (struct se_subsystem_dev *)p; | |
1683 | + struct se_subsystem_dev *se_dev = p; | |
1684 | 1684 | |
1685 | 1685 | if (!(se_dev->su_dev_flags & SDF_USING_ALIAS)) |
1686 | 1686 | return 0; |
... | ... | @@ -1693,7 +1693,7 @@ |
1693 | 1693 | const char *page, |
1694 | 1694 | size_t count) |
1695 | 1695 | { |
1696 | - struct se_subsystem_dev *se_dev = (struct se_subsystem_dev *)p; | |
1696 | + struct se_subsystem_dev *se_dev = p; | |
1697 | 1697 | struct se_hba *hba = se_dev->se_dev_hba; |
1698 | 1698 | ssize_t read_bytes; |
1699 | 1699 | |
... | ... | @@ -1726,7 +1726,7 @@ |
1726 | 1726 | |
1727 | 1727 | static ssize_t target_core_show_dev_udev_path(void *p, char *page) |
1728 | 1728 | { |
1729 | - struct se_subsystem_dev *se_dev = (struct se_subsystem_dev *)p; | |
1729 | + struct se_subsystem_dev *se_dev = p; | |
1730 | 1730 | |
1731 | 1731 | if (!(se_dev->su_dev_flags & SDF_USING_UDEV_PATH)) |
1732 | 1732 | return 0; |
... | ... | @@ -1739,7 +1739,7 @@ |
1739 | 1739 | const char *page, |
1740 | 1740 | size_t count) |
1741 | 1741 | { |
1742 | - struct se_subsystem_dev *se_dev = (struct se_subsystem_dev *)p; | |
1742 | + struct se_subsystem_dev *se_dev = p; | |
1743 | 1743 | struct se_hba *hba = se_dev->se_dev_hba; |
1744 | 1744 | ssize_t read_bytes; |
1745 | 1745 | |
... | ... | @@ -1775,7 +1775,7 @@ |
1775 | 1775 | const char *page, |
1776 | 1776 | size_t count) |
1777 | 1777 | { |
1778 | - struct se_subsystem_dev *se_dev = (struct se_subsystem_dev *)p; | |
1778 | + struct se_subsystem_dev *se_dev = p; | |
1779 | 1779 | struct se_device *dev; |
1780 | 1780 | struct se_hba *hba = se_dev->se_dev_hba; |
1781 | 1781 | struct se_subsystem_api *t = hba->transport; |
... | ... | @@ -1820,7 +1820,7 @@ |
1820 | 1820 | static ssize_t target_core_show_alua_lu_gp(void *p, char *page) |
1821 | 1821 | { |
1822 | 1822 | struct se_device *dev; |
1823 | - struct se_subsystem_dev *su_dev = (struct se_subsystem_dev *)p; | |
1823 | + struct se_subsystem_dev *su_dev = p; | |
1824 | 1824 | struct config_item *lu_ci; |
1825 | 1825 | struct t10_alua_lu_gp *lu_gp; |
1826 | 1826 | struct t10_alua_lu_gp_member *lu_gp_mem; |
... | ... | @@ -1858,7 +1858,7 @@ |
1858 | 1858 | size_t count) |
1859 | 1859 | { |
1860 | 1860 | struct se_device *dev; |
1861 | - struct se_subsystem_dev *su_dev = (struct se_subsystem_dev *)p; | |
1861 | + struct se_subsystem_dev *su_dev = p; | |
1862 | 1862 | struct se_hba *hba = su_dev->se_dev_hba; |
1863 | 1863 | struct t10_alua_lu_gp *lu_gp = NULL, *lu_gp_new = NULL; |
1864 | 1864 | struct t10_alua_lu_gp_member *lu_gp_mem; |
drivers/target/target_core_fabric_lib.c
... | ... | @@ -399,7 +399,7 @@ |
399 | 399 | add_len = ((buf[2] >> 8) & 0xff); |
400 | 400 | add_len |= (buf[3] & 0xff); |
401 | 401 | |
402 | - tid_len = strlen((char *)&buf[4]); | |
402 | + tid_len = strlen(&buf[4]); | |
403 | 403 | tid_len += 4; /* Add four bytes for iSCSI Transport ID header */ |
404 | 404 | tid_len += 1; /* Add one byte for NULL terminator */ |
405 | 405 | padding = ((-tid_len) & 3); |
406 | 406 | |
... | ... | @@ -420,11 +420,11 @@ |
420 | 420 | * format. |
421 | 421 | */ |
422 | 422 | if (format_code == 0x40) { |
423 | - p = strstr((char *)&buf[4], ",i,0x"); | |
423 | + p = strstr(&buf[4], ",i,0x"); | |
424 | 424 | if (!p) { |
425 | 425 | pr_err("Unable to locate \",i,0x\" seperator" |
426 | 426 | " for Initiator port identifier: %s\n", |
427 | - (char *)&buf[4]); | |
427 | + &buf[4]); | |
428 | 428 | return NULL; |
429 | 429 | } |
430 | 430 | *p = '\0'; /* Terminate iSCSI Name */ |
drivers/target/target_core_file.c
... | ... | @@ -85,7 +85,7 @@ |
85 | 85 | static void *fd_allocate_virtdevice(struct se_hba *hba, const char *name) |
86 | 86 | { |
87 | 87 | struct fd_dev *fd_dev; |
88 | - struct fd_host *fd_host = (struct fd_host *) hba->hba_ptr; | |
88 | + struct fd_host *fd_host = hba->hba_ptr; | |
89 | 89 | |
90 | 90 | fd_dev = kzalloc(sizeof(struct fd_dev), GFP_KERNEL); |
91 | 91 | if (!fd_dev) { |
... | ... | @@ -113,8 +113,8 @@ |
113 | 113 | struct se_device *dev; |
114 | 114 | struct se_dev_limits dev_limits; |
115 | 115 | struct queue_limits *limits; |
116 | - struct fd_dev *fd_dev = (struct fd_dev *) p; | |
117 | - struct fd_host *fd_host = (struct fd_host *) hba->hba_ptr; | |
116 | + struct fd_dev *fd_dev = p; | |
117 | + struct fd_host *fd_host = hba->hba_ptr; | |
118 | 118 | mm_segment_t old_fs; |
119 | 119 | struct file *file; |
120 | 120 | struct inode *inode = NULL; |
... | ... | @@ -239,7 +239,7 @@ |
239 | 239 | */ |
240 | 240 | static void fd_free_device(void *p) |
241 | 241 | { |
242 | - struct fd_dev *fd_dev = (struct fd_dev *) p; | |
242 | + struct fd_dev *fd_dev = p; | |
243 | 243 | |
244 | 244 | if (fd_dev->fd_file) { |
245 | 245 | filp_close(fd_dev->fd_file, NULL); |
... | ... | @@ -558,7 +558,7 @@ |
558 | 558 | |
559 | 559 | static ssize_t fd_check_configfs_dev_params(struct se_hba *hba, struct se_subsystem_dev *se_dev) |
560 | 560 | { |
561 | - struct fd_dev *fd_dev = (struct fd_dev *) se_dev->se_dev_su_ptr; | |
561 | + struct fd_dev *fd_dev = se_dev->se_dev_su_ptr; | |
562 | 562 | |
563 | 563 | if (!(fd_dev->fbd_flags & FBDF_HAS_PATH)) { |
564 | 564 | pr_err("Missing fd_dev_name=\n"); |
drivers/target/target_core_iblock.c
... | ... | @@ -464,7 +464,7 @@ |
464 | 464 | if (bd) { |
465 | 465 | bl += sprintf(b + bl, "Major: %d Minor: %d %s\n", |
466 | 466 | MAJOR(bd->bd_dev), MINOR(bd->bd_dev), (!bd->bd_contains) ? |
467 | - "" : (bd->bd_holder == (struct iblock_dev *)ibd) ? | |
467 | + "" : (bd->bd_holder == ibd) ? | |
468 | 468 | "CLAIMED: IBLOCK" : "CLAIMED: OS"); |
469 | 469 | } else { |
470 | 470 | bl += sprintf(b + bl, "Major: 0 Minor: 0\n"); |
drivers/target/target_core_pscsi.c
... | ... | @@ -104,7 +104,7 @@ |
104 | 104 | |
105 | 105 | static int pscsi_pmode_enable_hba(struct se_hba *hba, unsigned long mode_flag) |
106 | 106 | { |
107 | - struct pscsi_hba_virt *phv = (struct pscsi_hba_virt *)hba->hba_ptr; | |
107 | + struct pscsi_hba_virt *phv = hba->hba_ptr; | |
108 | 108 | struct Scsi_Host *sh = phv->phv_lld_host; |
109 | 109 | /* |
110 | 110 | * Release the struct Scsi_Host |
... | ... | @@ -405,7 +405,7 @@ |
405 | 405 | __releases(sh->host_lock) |
406 | 406 | { |
407 | 407 | struct se_device *dev; |
408 | - struct pscsi_hba_virt *phv = (struct pscsi_hba_virt *)pdv->pdv_se_hba->hba_ptr; | |
408 | + struct pscsi_hba_virt *phv = pdv->pdv_se_hba->hba_ptr; | |
409 | 409 | struct Scsi_Host *sh = sd->host; |
410 | 410 | struct block_device *bd; |
411 | 411 | u32 dev_flags = 0; |
... | ... | @@ -453,7 +453,7 @@ |
453 | 453 | __releases(sh->host_lock) |
454 | 454 | { |
455 | 455 | struct se_device *dev; |
456 | - struct pscsi_hba_virt *phv = (struct pscsi_hba_virt *)pdv->pdv_se_hba->hba_ptr; | |
456 | + struct pscsi_hba_virt *phv = pdv->pdv_se_hba->hba_ptr; | |
457 | 457 | struct Scsi_Host *sh = sd->host; |
458 | 458 | u32 dev_flags = 0; |
459 | 459 | |
... | ... | @@ -488,7 +488,7 @@ |
488 | 488 | __releases(sh->host_lock) |
489 | 489 | { |
490 | 490 | struct se_device *dev; |
491 | - struct pscsi_hba_virt *phv = (struct pscsi_hba_virt *)pdv->pdv_se_hba->hba_ptr; | |
491 | + struct pscsi_hba_virt *phv = pdv->pdv_se_hba->hba_ptr; | |
492 | 492 | struct Scsi_Host *sh = sd->host; |
493 | 493 | u32 dev_flags = 0; |
494 | 494 | |
495 | 495 | |
... | ... | @@ -509,10 +509,10 @@ |
509 | 509 | struct se_subsystem_dev *se_dev, |
510 | 510 | void *p) |
511 | 511 | { |
512 | - struct pscsi_dev_virt *pdv = (struct pscsi_dev_virt *)p; | |
512 | + struct pscsi_dev_virt *pdv = p; | |
513 | 513 | struct se_device *dev; |
514 | 514 | struct scsi_device *sd; |
515 | - struct pscsi_hba_virt *phv = (struct pscsi_hba_virt *)hba->hba_ptr; | |
515 | + struct pscsi_hba_virt *phv = hba->hba_ptr; | |
516 | 516 | struct Scsi_Host *sh = phv->phv_lld_host; |
517 | 517 | int legacy_mode_enable = 0; |
518 | 518 | |
... | ... | @@ -1143,7 +1143,7 @@ |
1143 | 1143 | { |
1144 | 1144 | struct pscsi_plugin_task *pt = PSCSI_TASK(task); |
1145 | 1145 | |
1146 | - return (unsigned char *)&pt->pscsi_sense[0]; | |
1146 | + return pt->pscsi_sense; | |
1147 | 1147 | } |
1148 | 1148 | |
1149 | 1149 | /* pscsi_get_device_rev(): |
drivers/target/target_core_stat.c
... | ... | @@ -1755,8 +1755,7 @@ |
1755 | 1755 | /* scsiAttIntrPortName+scsiAttIntrPortIdentifier */ |
1756 | 1756 | memset(buf, 0, 64); |
1757 | 1757 | if (tpg->se_tpg_tfo->sess_get_initiator_sid != NULL) |
1758 | - tpg->se_tpg_tfo->sess_get_initiator_sid(se_sess, | |
1759 | - (unsigned char *)&buf[0], 64); | |
1758 | + tpg->se_tpg_tfo->sess_get_initiator_sid(se_sess, buf, 64); | |
1760 | 1759 | |
1761 | 1760 | ret = snprintf(page, PAGE_SIZE, "%s+i+%s\n", nacl->initiatorname, buf); |
1762 | 1761 | spin_unlock_irq(&nacl->nacl_sess_lock); |
drivers/target/target_core_transport.c
... | ... | @@ -4161,7 +4161,7 @@ |
4161 | 4161 | |
4162 | 4162 | static int transport_clear_lun_thread(void *p) |
4163 | 4163 | { |
4164 | - struct se_lun *lun = (struct se_lun *)p; | |
4164 | + struct se_lun *lun = p; | |
4165 | 4165 | |
4166 | 4166 | __transport_clear_lun_from_sessions(lun); |
4167 | 4167 | complete(&lun->lun_shutdown_comp); |
... | ... | @@ -4580,7 +4580,7 @@ |
4580 | 4580 | { |
4581 | 4581 | int ret; |
4582 | 4582 | struct se_cmd *cmd; |
4583 | - struct se_device *dev = (struct se_device *) param; | |
4583 | + struct se_device *dev = param; | |
4584 | 4584 | |
4585 | 4585 | while (!kthread_should_stop()) { |
4586 | 4586 | ret = wait_event_interruptible(dev->dev_queue_obj.thread_wq, |