Commit cab80d98 authored by Vitaly Osipov's avatar Vitaly Osipov Committed by Greg Kroah-Hartman

staging: lustre: remove memset(0) after LIBCFS_ALLOC

Joe Perches mentioned on driverdev-devel that memset after LIBCFS_ALLOC
is not necessary as it is already done during LIBCFS_ALLOC_POST. This
commit removes these unnecessary memsets. Based on the results of running
a cocci patch along the lines of:

@@
expression E1, E2;
@@

LIBCFS_ALLOC (E1,E2);
...
- memset(E1,0,E2);
Signed-off-by: default avatarVitaly Osipov <vitaly.osipov@gmail.com>
Reviewed-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 4fad177c
...@@ -2430,8 +2430,6 @@ kiblnd_hdev_setup_mrs(kib_hca_dev_t *hdev) ...@@ -2430,8 +2430,6 @@ kiblnd_hdev_setup_mrs(kib_hca_dev_t *hdev)
return -ENOMEM; return -ENOMEM;
} }
memset(hdev->ibh_mrs, 0, sizeof(*hdev->ibh_mrs) * hdev->ibh_nmrs);
for (i = 0; i < hdev->ibh_nmrs; i++) { for (i = 0; i < hdev->ibh_nmrs; i++) {
struct ib_phys_buf ipb; struct ib_phys_buf ipb;
__u64 iova; __u64 iova;
...@@ -2704,7 +2702,6 @@ kiblnd_create_dev(char *ifname) ...@@ -2704,7 +2702,6 @@ kiblnd_create_dev(char *ifname)
if (dev == NULL) if (dev == NULL)
return NULL; return NULL;
memset(dev, 0, sizeof(*dev));
netdev = dev_get_by_name(&init_net, ifname); netdev = dev_get_by_name(&init_net, ifname);
if (netdev == NULL) { if (netdev == NULL) {
dev->ibd_can_failover = 0; dev->ibd_can_failover = 0;
...@@ -3088,8 +3085,6 @@ kiblnd_startup (lnet_ni_t *ni) ...@@ -3088,8 +3085,6 @@ kiblnd_startup (lnet_ni_t *ni)
if (net == NULL) if (net == NULL)
goto failed; goto failed;
memset(net, 0, sizeof(*net));
do_gettimeofday(&tv); do_gettimeofday(&tv);
net->ibn_incarnation = (((__u64)tv.tv_sec) * 1000000) + tv.tv_usec; net->ibn_incarnation = (((__u64)tv.tv_sec) * 1000000) + tv.tv_usec;
......
...@@ -113,8 +113,6 @@ ksocknal_create_peer (ksock_peer_t **peerp, lnet_ni_t *ni, lnet_process_id_t id) ...@@ -113,8 +113,6 @@ ksocknal_create_peer (ksock_peer_t **peerp, lnet_ni_t *ni, lnet_process_id_t id)
if (peer == NULL) if (peer == NULL)
return -ENOMEM; return -ENOMEM;
memset (peer, 0, sizeof (*peer)); /* NULL pointers/clear flags etc */
peer->ksnp_ni = ni; peer->ksnp_ni = ni;
peer->ksnp_id = id; peer->ksnp_id = id;
atomic_set (&peer->ksnp_refcount, 1); /* 1 ref for caller */ atomic_set (&peer->ksnp_refcount, 1); /* 1 ref for caller */
...@@ -1040,8 +1038,6 @@ ksocknal_create_conn (lnet_ni_t *ni, ksock_route_t *route, ...@@ -1040,8 +1038,6 @@ ksocknal_create_conn (lnet_ni_t *ni, ksock_route_t *route,
goto failed_0; goto failed_0;
} }
memset (conn, 0, sizeof (*conn));
conn->ksnc_peer = NULL; conn->ksnc_peer = NULL;
conn->ksnc_route = NULL; conn->ksnc_route = NULL;
conn->ksnc_sock = sock; conn->ksnc_sock = sock;
......
...@@ -866,7 +866,6 @@ lnet_create_rc_data_locked(lnet_peer_t *gateway) ...@@ -866,7 +866,6 @@ lnet_create_rc_data_locked(lnet_peer_t *gateway)
if (pi == NULL) if (pi == NULL)
goto out; goto out;
memset(pi, 0, LNET_PINGINFO_SIZE);
for (i = 0; i < LNET_MAX_RTR_NIS; i++) { for (i = 0; i < LNET_MAX_RTR_NIS; i++) {
pi->pi_ni[i].ns_nid = LNET_NID_ANY; pi->pi_ni[i].ns_nid = LNET_NID_ANY;
pi->pi_ni[i].ns_status = LNET_NI_STATUS_INVALID; pi->pi_ni[i].ns_status = LNET_NI_STATUS_INVALID;
......
...@@ -204,9 +204,6 @@ lstcon_group_alloc(char *name, lstcon_group_t **grpp) ...@@ -204,9 +204,6 @@ lstcon_group_alloc(char *name, lstcon_group_t **grpp)
if (grp == NULL) if (grp == NULL)
return -ENOMEM; return -ENOMEM;
memset(grp, 0, offsetof(lstcon_group_t,
grp_ndl_hash[LST_NODE_HASHSIZE]));
grp->grp_ref = 1; grp->grp_ref = 1;
if (name != NULL) if (name != NULL)
strcpy(grp->grp_name, name); strcpy(grp->grp_name, name);
...@@ -815,8 +812,6 @@ lstcon_group_info(char *name, lstcon_ndlist_ent_t *gents_p, ...@@ -815,8 +812,6 @@ lstcon_group_info(char *name, lstcon_ndlist_ent_t *gents_p,
return -ENOMEM; return -ENOMEM;
} }
memset(gentp, 0, sizeof(lstcon_ndlist_ent_t));
list_for_each_entry(ndl, &grp->grp_ndl_list, ndl_link) list_for_each_entry(ndl, &grp->grp_ndl_list, ndl_link)
LST_NODE_STATE_COUNTER(ndl->ndl_node, gentp); LST_NODE_STATE_COUNTER(ndl->ndl_node, gentp);
...@@ -971,8 +966,6 @@ lstcon_batch_info(char *name, lstcon_test_batch_ent_t *ent_up, int server, ...@@ -971,8 +966,6 @@ lstcon_batch_info(char *name, lstcon_test_batch_ent_t *ent_up, int server,
if (entp == NULL) if (entp == NULL)
return -ENOMEM; return -ENOMEM;
memset(entp, 0, sizeof(lstcon_test_batch_ent_t));
if (test == NULL) { if (test == NULL) {
entp->u.tbe_batch.bae_ntest = bat->bat_ntest; entp->u.tbe_batch.bae_ntest = bat->bat_ntest;
entp->u.tbe_batch.bae_state = bat->bat_state; entp->u.tbe_batch.bae_state = bat->bat_state;
...@@ -1319,7 +1312,6 @@ lstcon_test_add(char *batch_name, int type, int loop, ...@@ -1319,7 +1312,6 @@ lstcon_test_add(char *batch_name, int type, int loop,
goto out; goto out;
} }
memset(test, 0, offsetof(lstcon_test_t, tes_param[paramlen]));
test->tes_hdr.tsb_id = batch->bat_hdr.tsb_id; test->tes_hdr.tsb_id = batch->bat_hdr.tsb_id;
test->tes_batch = batch; test->tes_batch = batch;
test->tes_type = type; test->tes_type = type;
...@@ -1789,8 +1781,6 @@ lstcon_session_info(lst_sid_t *sid_up, int *key_up, unsigned *featp, ...@@ -1789,8 +1781,6 @@ lstcon_session_info(lst_sid_t *sid_up, int *key_up, unsigned *featp,
if (entp == NULL) if (entp == NULL)
return -ENOMEM; return -ENOMEM;
memset(entp, 0, sizeof(*entp));
list_for_each_entry(ndl, &console_session.ses_ndl_list, ndl_link) list_for_each_entry(ndl, &console_session.ses_ndl_list, ndl_link)
LST_NODE_STATE_COUNTER(ndl->ndl_node, entp); LST_NODE_STATE_COUNTER(ndl->ndl_node, entp);
......
...@@ -149,7 +149,6 @@ sfw_register_test (srpc_service_t *service, sfw_test_client_ops_t *cliops) ...@@ -149,7 +149,6 @@ sfw_register_test (srpc_service_t *service, sfw_test_client_ops_t *cliops)
if (tsc == NULL) if (tsc == NULL)
return -ENOMEM; return -ENOMEM;
memset(tsc, 0, sizeof(sfw_test_case_t));
tsc->tsc_cli_ops = cliops; tsc->tsc_cli_ops = cliops;
tsc->tsc_srv_service = service; tsc->tsc_srv_service = service;
...@@ -747,7 +746,6 @@ sfw_add_test_instance (sfw_batch_t *tsb, srpc_server_rpc_t *rpc) ...@@ -747,7 +746,6 @@ sfw_add_test_instance (sfw_batch_t *tsb, srpc_server_rpc_t *rpc)
return -ENOMEM; return -ENOMEM;
} }
memset(tsi, 0, sizeof(*tsi));
spin_lock_init(&tsi->tsi_lock); spin_lock_init(&tsi->tsi_lock);
atomic_set(&tsi->tsi_nactive, 0); atomic_set(&tsi->tsi_nactive, 0);
INIT_LIST_HEAD(&tsi->tsi_units); INIT_LIST_HEAD(&tsi->tsi_units);
......
...@@ -183,8 +183,6 @@ libcfs_ipif_enumerate (char ***namesp) ...@@ -183,8 +183,6 @@ libcfs_ipif_enumerate (char ***namesp)
rc = -ENOMEM; rc = -ENOMEM;
goto out1; goto out1;
} }
/* NULL out all names[i] */
memset (names, 0, nfound * sizeof(*names));
for (i = 0; i < nfound; i++) { for (i = 0; i < nfound; i++) {
......
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