From: Vitaly Osipov Date: Tue, 29 Mar 2016 00:25:12 +0000 (-0400) Subject: LU-4423 lnet: remove memset(0) after LIBCFS_ALLOC X-Git-Tag: 2.8.52~25 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=2728c9c104246d4b2811f230f8711f7544187a75 LU-4423 lnet: 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); Linux-commit : cab80d98f50bbacb7df79bd267d0b2b008b2d84f Change-Id: I49b48539d7b99e59e3bb56f9ad74efed101d8a4e Signed-off-by: Vitaly Osipov Reviewed-by: Dan Carpenter Signed-off-by: Greg Kroah-Hartman Signed-off-by: James Simmons Reviewed-on: http://review.whamcloud.com/18954 Reviewed-by: Doug Oucharek Tested-by: Jenkins Reviewed-by: Dmitry Eremin Tested-by: Maloo Reviewed-by: Frank Zago Reviewed-by: John L. Hammond Reviewed-by: Oleg Drokin --- diff --git a/lnet/klnds/o2iblnd/o2iblnd.c b/lnet/klnds/o2iblnd/o2iblnd.c index d13ace0..100ea1b 100644 --- a/lnet/klnds/o2iblnd/o2iblnd.c +++ b/lnet/klnds/o2iblnd/o2iblnd.c @@ -2677,7 +2677,6 @@ kiblnd_create_dev(char *ifname) if (dev == NULL) return NULL; - memset(dev, 0, sizeof(*dev)); netdev = dev_get_by_name(&init_net, ifname); if (netdev == NULL) { dev->ibd_can_failover = 0; @@ -3068,8 +3067,6 @@ kiblnd_startup (lnet_ni_t *ni) if (net == NULL) goto failed; - memset(net, 0, sizeof(*net)); - do_gettimeofday(&tv); net->ibn_incarnation = (((__u64)tv.tv_sec) * 1000000) + tv.tv_usec; diff --git a/lnet/klnds/socklnd/socklnd.c b/lnet/klnds/socklnd/socklnd.c index 873e1ac..3c50e5c 100644 --- a/lnet/klnds/socklnd/socklnd.c +++ b/lnet/klnds/socklnd/socklnd.c @@ -1044,8 +1044,6 @@ ksocknal_create_conn(lnet_ni_t *ni, ksock_route_t *route, goto failed_0; } - memset (conn, 0, sizeof (*conn)); - conn->ksnc_peer = NULL; conn->ksnc_route = NULL; conn->ksnc_sock = sock; diff --git a/lnet/selftest/console.c b/lnet/selftest/console.c index af050a1..f951c17 100644 --- a/lnet/selftest/console.c +++ b/lnet/selftest/console.c @@ -205,9 +205,6 @@ lstcon_group_alloc(char *name, lstcon_group_t **grpp) if (grp == NULL) return -ENOMEM; - memset(grp, 0, offsetof(lstcon_group_t, - grp_ndl_hash[LST_NODE_HASHSIZE])); - grp->grp_ref = 1; if (name != NULL) { if (strlen(name) > sizeof(grp->grp_name)-1) { @@ -817,8 +814,6 @@ lstcon_group_info(char *name, lstcon_ndlist_ent_t __user *gents_p, return -ENOMEM; } - memset(gentp, 0, sizeof(lstcon_ndlist_ent_t)); - list_for_each_entry(ndl, &grp->grp_ndl_list, ndl_link) LST_NODE_STATE_COUNTER(ndl->ndl_node, gentp); @@ -979,8 +974,6 @@ lstcon_batch_info(char *name, lstcon_test_batch_ent_t __user *ent_up, if (entp == NULL) return -ENOMEM; - memset(entp, 0, sizeof(lstcon_test_batch_ent_t)); - if (test == NULL) { entp->u.tbe_batch.bae_ntest = bat->bat_ntest; entp->u.tbe_batch.bae_state = bat->bat_state; @@ -1328,7 +1321,6 @@ lstcon_test_add(char *batch_name, int type, int loop, goto out; } - memset(test, 0, offsetof(lstcon_test_t, tes_param[paramlen])); test->tes_hdr.tsb_id = batch->bat_hdr.tsb_id; test->tes_batch = batch; test->tes_type = type; @@ -1805,8 +1797,6 @@ lstcon_session_info(lst_sid_t __user *sid_up, int __user *key_up, if (entp == NULL) return -ENOMEM; - memset(entp, 0, sizeof(*entp)); - list_for_each_entry(ndl, &console_session.ses_ndl_list, ndl_link) LST_NODE_STATE_COUNTER(ndl->ndl_node, entp); diff --git a/lnet/selftest/framework.c b/lnet/selftest/framework.c index b5bd9e5..3b8fe0a 100644 --- a/lnet/selftest/framework.c +++ b/lnet/selftest/framework.c @@ -157,7 +157,6 @@ sfw_register_test (srpc_service_t *service, sfw_test_client_ops_t *cliops) if (tsc == NULL) return -ENOMEM; - memset(tsc, 0, sizeof(sfw_test_case_t)); tsc->tsc_cli_ops = cliops; tsc->tsc_srv_service = service; @@ -763,7 +762,6 @@ sfw_add_test_instance (sfw_batch_t *tsb, srpc_server_rpc_t *rpc) return -ENOMEM; } - memset(tsi, 0, sizeof(*tsi)); spin_lock_init(&tsi->tsi_lock); atomic_set(&tsi->tsi_nactive, 0); INIT_LIST_HEAD(&tsi->tsi_units);