Whamcloud - gitweb
LU-5304: do not memset after LIBCFS_ALLOC 12/11012/4
authorFrank Zago <fzago@cray.com>
Mon, 7 Jul 2014 22:39:13 +0000 (17:39 -0500)
committerOleg Drokin <oleg.drokin@intel.com>
Tue, 15 Jul 2014 03:58:50 +0000 (03:58 +0000)
LIBCFS_ALLOC already zero out the memory allocated, so there is no
need to zero out the memory again.

Signed-off-by: Frank Zago <fzago@cray.com>
Change-Id: Iac0210eefa999e6ef52bb16cacc67854ef5a8cfa
Reviewed-on: http://review.whamcloud.com/11012
Reviewed-by: Patrick Farrell <paf@cray.com>
Tested-by: Jenkins
Reviewed-by: James Simmons <uja.ornl@gmail.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
libcfs/include/libcfs/params_tree.h
libcfs/libcfs/linux/linux-tcpip.c
lnet/klnds/o2iblnd/o2iblnd.c
lnet/lnet/api-ni.c
lnet/lnet/router.c

index 238408c..0bfbdf7 100644 (file)
@@ -179,13 +179,14 @@ seq_open(struct file *file, const struct seq_operations *fops)
 {
        struct seq_file *p = file->param_private;
 
-       if (!p) {
+       if (p == NULL) {
                LIBCFS_ALLOC(p, sizeof(*p));
-               if (!p)
+               if (p == NULL)
                        return -ENOMEM;
                file->param_private = p;
+       } else {
+               memset(p, 0, sizeof(*p));
        }
-       memset(p, 0, sizeof(*p));
        p->op = fops;
        return 0;
 }
index dd609c0..de1a63f 100644 (file)
@@ -234,8 +234,6 @@ libcfs_ipif_enumerate (char ***namesp)
                 rc = -ENOMEM;
                 goto out1;
         }
-        /* NULL out all names[i] */
-        memset (names, 0, nfound * sizeof(*names));
 
         for (i = 0; i < nfound; i++) {
 
index c0b4408..18ad6a6 100644 (file)
@@ -340,8 +340,6 @@ kiblnd_create_peer(lnet_ni_t *ni, kib_peer_t **peerp, lnet_nid_t nid)
                 return -ENOMEM;
         }
 
-       memset(peer, 0, sizeof(*peer));         /* zero flags etc */
-
        peer->ibp_ni = ni;
        peer->ibp_nid = nid;
        peer->ibp_error = 0;
index 58e0126..1a2294f 100644 (file)
@@ -475,7 +475,6 @@ lnet_freelist_init(lnet_freelist_t *fl, int n, int size)
        fl->fl_objsize = size;
 
        do {
-               memset(space, 0, size);
                list_add((struct list_head *)space, &fl->fl_list);
                space += size;
        } while (--n != 0);
index f4827ad..e041a37 100644 (file)
@@ -860,7 +860,6 @@ lnet_create_rc_data_locked(lnet_peer_t *gateway)
        if (pi == NULL)
                goto out;
 
-        memset(pi, 0, LNET_PINGINFO_SIZE);
         for (i = 0; i < LNET_MAX_RTR_NIS; i++) {
                 pi->pi_ni[i].ns_nid = LNET_NID_ANY;
                 pi->pi_ni[i].ns_status = LNET_NI_STATUS_INVALID;