Whamcloud - gitweb
LU-3097 build: fix 'deadcode' errors 67/7167/2
authorSebastien Buisson <sebastien.buisson@bull.net>
Mon, 29 Jul 2013 15:25:47 +0000 (17:25 +0200)
committerOleg Drokin <oleg.drokin@intel.com>
Sat, 10 Aug 2013 04:32:08 +0000 (04:32 +0000)
Fix 'deadcode' issues found by Coverity version 6.5.1:
Logically dead code (DEADCODE)
Execution cannot reach this statement.

Signed-off-by: Sebastien Buisson <sebastien.buisson@bull.net>
Change-Id: I720a5ae6f963cd2cc77208a854ca4587758a82d5
Reviewed-on: http://review.whamcloud.com/7167
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
libcfs/libcfs/linux/linux-curproc.c
lustre/ldlm/ldlm_flock.c
lustre/ldlm/ldlm_lib.c
lustre/obdclass/obd_mount_server.c
lustre/utils/lustre_cfg.c

index 313c012..2c11370 100644 (file)
@@ -254,7 +254,7 @@ static int cfs_access_process_vm(struct task_struct *tsk, unsigned long addr,
 int cfs_get_environ(const char *key, char *value, int *val_len)
 {
        struct mm_struct *mm;
-       char *buffer, *tmp_buf = NULL;
+       char *buffer;
        int buf_len = PAGE_CACHE_SIZE;
        int key_len = strlen(key);
        unsigned long addr;
@@ -346,8 +346,6 @@ int cfs_get_environ(const char *key, char *value, int *val_len)
 out:
        mmput(mm);
        kfree((void *)buffer);
-       if (tmp_buf)
-               kfree((void *)tmp_buf);
        return rc;
 }
 EXPORT_SYMBOL(cfs_get_environ);
index c141438..2f6e357 100644 (file)
@@ -704,12 +704,6 @@ granted:
                 RETURN(-EIO);
         }
 
-        if (rc) {
-                LDLM_DEBUG(lock, "client-side enqueue waking up: failed (%d)",
-                           rc);
-                RETURN(rc);
-        }
-
         LDLM_DEBUG(lock, "client-side enqueue granted");
 
        lock_res_and_lock(lock);
index 84d7660..a5b875a 100644 (file)
@@ -868,34 +868,30 @@ int target_handle_connect(struct ptlrpc_request *req)
         if (rc)
                 GOTO(out, rc);
 
-        if (lustre_msg_get_op_flags(req->rq_reqmsg) & MSG_CONNECT_LIBCLIENT) {
-                if (!data) {
-                        DEBUG_REQ(D_WARNING, req, "Refusing old (unversioned) "
-                                  "libclient connection attempt");
-                        GOTO(out, rc = -EPROTO);
-                } else if (data->ocd_version < LUSTRE_VERSION_CODE -
-                                               LUSTRE_VERSION_ALLOWED_OFFSET ||
-                           data->ocd_version > LUSTRE_VERSION_CODE +
-                                               LUSTRE_VERSION_ALLOWED_OFFSET) {
-                        DEBUG_REQ(D_WARNING, req, "Refusing %s (%d.%d.%d.%d) "
-                                  "libclient connection attempt",
-                                  data->ocd_version < LUSTRE_VERSION_CODE ?
-                                  "old" : "new",
-                                  OBD_OCD_VERSION_MAJOR(data->ocd_version),
-                                  OBD_OCD_VERSION_MINOR(data->ocd_version),
-                                  OBD_OCD_VERSION_PATCH(data->ocd_version),
-                                  OBD_OCD_VERSION_FIX(data->ocd_version));
-                        data = req_capsule_server_sized_get(&req->rq_pill,
-                                                        &RMF_CONNECT_DATA,
-                                    offsetof(typeof(*data), ocd_version) +
-                                             sizeof(data->ocd_version));
-                        if (data) {
-                                data->ocd_connect_flags = OBD_CONNECT_VERSION;
-                                data->ocd_version = LUSTRE_VERSION_CODE;
-                        }
-                        GOTO(out, rc = -EPROTO);
-                }
-        }
+       if (lustre_msg_get_op_flags(req->rq_reqmsg) & MSG_CONNECT_LIBCLIENT) {
+               if (data->ocd_version < LUSTRE_VERSION_CODE -
+                                              LUSTRE_VERSION_ALLOWED_OFFSET ||
+                   data->ocd_version > LUSTRE_VERSION_CODE +
+                                              LUSTRE_VERSION_ALLOWED_OFFSET) {
+                       DEBUG_REQ(D_WARNING, req, "Refusing %s (%d.%d.%d.%d) "
+                                 "libclient connection attempt",
+                                 data->ocd_version < LUSTRE_VERSION_CODE ?
+                                 "old" : "new",
+                                 OBD_OCD_VERSION_MAJOR(data->ocd_version),
+                                 OBD_OCD_VERSION_MINOR(data->ocd_version),
+                                 OBD_OCD_VERSION_PATCH(data->ocd_version),
+                                 OBD_OCD_VERSION_FIX(data->ocd_version));
+                       data = req_capsule_server_sized_get(&req->rq_pill,
+                                                           &RMF_CONNECT_DATA,
+                                   offsetof(typeof(*data), ocd_version) +
+                                            sizeof(data->ocd_version));
+                       if (data) {
+                               data->ocd_connect_flags = OBD_CONNECT_VERSION;
+                               data->ocd_version = LUSTRE_VERSION_CODE;
+                       }
+                       GOTO(out, rc = -EPROTO);
+               }
+       }
 
         if ((lustre_msg_get_op_flags(req->rq_reqmsg) & MSG_CONNECT_INITIAL) &&
             (data->ocd_connect_flags & OBD_CONNECT_MDS))
index ad35237..c3352d7 100644 (file)
@@ -567,7 +567,6 @@ out:
  **/
 static int lustre_lwp_setup(struct lustre_cfg *lcfg, struct lustre_sb_info *lsi)
 {
-       struct obd_connect_data *data = NULL;
        struct obd_device       *obd;
        char                    *lwpname = NULL;
        char                    *lwpuuid = NULL;
@@ -612,8 +611,6 @@ static int lustre_lwp_setup(struct lustre_cfg *lcfg, struct lustre_sb_info *lsi)
        if (rc != 0)
                CERROR("%s: connect failed: rc = %d\n", lwpname, rc);
 out:
-       if (data != NULL)
-               OBD_FREE_PTR(data);
        if (lwpname != NULL)
                OBD_FREE(lwpname, MTI_NAME_MAXLEN);
        if (lwpuuid != NULL)
index e709115..016ae70 100644 (file)
@@ -139,19 +139,6 @@ int jt_lcfg_attach(int argc, char **argv)
         if (rc < 0) {
                 fprintf(stderr, "error: %s: LCFG_ATTACH %s\n",
                         jt_cmdname(argv[0]), strerror(rc = errno));
-        } else if (argc == 3) {
-                char name[1024];
-
-                lcfg_set_devname(argv[2]);
-                if (strlen(argv[2]) > 128) {
-                        printf("Name too long to set environment\n");
-                        return -EINVAL;
-                }
-                snprintf(name, 512, "LUSTRE_DEV_%s", argv[2]);
-                rc = setenv(name, argv[1], 1);
-                if (rc) {
-                        printf("error setting env variable %s\n", name);
-                }
         } else {
                 lcfg_set_devname(argv[2]);
         }