staging: lustre: cleanup not needed else clauses
authorAntonio Murdaca <antoniomurdaca@gmail.com>
Mon, 8 Jun 2015 19:48:41 +0000 (21:48 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 8 Jun 2015 20:15:38 +0000 (13:15 -0700)
cleanup checkpatch.pl warnings about not needed else
clauses after a break or return

Signed-off-by: Antonio Murdaca <antonio.murdaca@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 files changed:
drivers/staging/lustre/lustre/fid/fid_request.c
drivers/staging/lustre/lustre/include/lprocfs_status.h
drivers/staging/lustre/lustre/ldlm/ldlm_lib.c
drivers/staging/lustre/lustre/ldlm/ldlm_lock.c
drivers/staging/lustre/lustre/ldlm/ldlm_pool.c
drivers/staging/lustre/lustre/lov/lov_request.c
drivers/staging/lustre/lustre/mdc/mdc_request.c
drivers/staging/lustre/lustre/obdclass/cl_object.c
drivers/staging/lustre/lustre/obdclass/llog_cat.c
drivers/staging/lustre/lustre/osc/osc_lock.c
drivers/staging/lustre/lustre/osc/osc_request.c
drivers/staging/lustre/lustre/ptlrpc/pinger.c

index 7b4e3c6782c3d3ae7ef1e627a29d9423b88617fb..1362783b7eab362a8df204826449c4aac50e47c0 100644 (file)
@@ -203,10 +203,9 @@ static int seq_client_alloc_seq(const struct lu_env *env,
                        CERROR("%s: Can't allocate new meta-sequence, rc %d\n",
                               seq->lcs_name, rc);
                        return rc;
-               } else {
-                       CDEBUG(D_INFO, "%s: New range - "DRANGE"\n",
-                              seq->lcs_name, PRANGE(&seq->lcs_space));
                }
+               CDEBUG(D_INFO, "%s: New range - "DRANGE"\n",
+                      seq->lcs_name, PRANGE(&seq->lcs_space));
        } else {
                rc = 0;
        }
index 3292fd3c588a5620c20359bf17c740cf85aaaf2e..8ede2a00ca4f5c51fa7c9242f70be5493d5fd0bf 100644 (file)
@@ -421,9 +421,8 @@ static inline int lprocfs_stats_lock(struct lprocfs_stats *stats, int opc,
                        else
                                spin_lock(&stats->ls_lock);
                        return 1;
-               } else {
-                       return stats->ls_biggest_alloc_num;
                }
+               return stats->ls_biggest_alloc_num;
        }
 }
 
index 0a0b435f11fcfad11c7dceacdf5f64a2d694ec2c..764f98684d74ef294b30942de737a5dbe3f2c420 100644 (file)
@@ -667,10 +667,9 @@ int target_send_reply_msg(struct ptlrpc_request *req, int rc, int fail_id)
                DEBUG_REQ(D_NET, req, "processing error (%d)", rc);
                req->rq_status = rc;
                return ptlrpc_send_error(req, 1);
-       } else {
-               DEBUG_REQ(D_NET, req, "sending reply");
        }
 
+       DEBUG_REQ(D_NET, req, "sending reply");
        return ptlrpc_send_reply(req, PTLRPC_REPLY_MAYBE_DIFFICULT);
 }
 
index 6a22f4183b308728d27a77e457409ec801bdfb40..bb2246d3b22b51978ef00122710c6c01c67e3f61 100644 (file)
@@ -931,7 +931,9 @@ static void search_granted_lock(struct list_head *queue,
                        prev->mode_link = &mode_end->l_sl_mode;
                        prev->policy_link = &req->l_sl_policy;
                        return;
-               } else if (lock->l_resource->lr_type == LDLM_IBITS) {
+               }
+
+               if (lock->l_resource->lr_type == LDLM_IBITS) {
                        for (;;) {
                                policy_end =
                                        list_entry(lock->l_sl_policy.prev,
@@ -967,11 +969,10 @@ static void search_granted_lock(struct list_head *queue,
                        prev->mode_link = &mode_end->l_sl_mode;
                        prev->policy_link = &req->l_sl_policy;
                        return;
-               } else {
-                       LDLM_ERROR(lock,
-                                  "is not LDLM_PLAIN or LDLM_IBITS lock");
-                       LBUG();
                }
+
+               LDLM_ERROR(lock, "is not LDLM_PLAIN or LDLM_IBITS lock");
+               LBUG();
        }
 
        /* insert point is last lock on the queue,
index 310cc60252fa6780bc4cf6698760f1fbe725b12c..1605b9c692715512109da73215a7e9ec1c597738 100644 (file)
@@ -1401,8 +1401,7 @@ static int ldlm_pools_thread_main(void *arg)
 
                if (thread_test_and_clear_flags(thread, SVC_STOPPING))
                        break;
-               else
-                       thread_test_and_clear_flags(thread, SVC_EVENT);
+               thread_test_and_clear_flags(thread, SVC_EVENT);
        }
 
        thread_set_flags(thread, SVC_STOPPED);
index f4f2058abd2ba2cd4d1d95c194aeba87332551de..f4de8b84c5c25188503c2672b3818a474ad0db9c 100644 (file)
@@ -607,8 +607,7 @@ void lov_update_statfs(struct obd_statfs *osfs, struct obd_statfs *lov_sfs,
                                if (tmp & 1) {
                                        if (quit)
                                                break;
-                                       else
-                                               quit = 1;
+                                       quit = 1;
                                        shift = 0;
                                }
                                tmp >>= 1;
index c9639413b105b9150a55d3a6265376021460d018..c23511f7c142ebda6c26237fda51d6e232de0b0f 100644 (file)
@@ -75,11 +75,11 @@ static int mdc_unpack_capa(struct obd_export *exp, struct ptlrpc_request *req,
        if (IS_ERR(c)) {
                CDEBUG(D_INFO, "alloc capa failed!\n");
                return PTR_ERR(c);
-       } else {
-               c->c_capa = *capa;
-               *oc = c;
-               return 0;
        }
+
+       c->c_capa = *capa;
+       *oc = c;
+       return 0;
 }
 
 static inline int mdc_queue_wait(struct ptlrpc_request *req)
index f13d1fbffd9d3f1a33a5e292732031ac5b409583..163fe0cd7f9aa84de19034df50e54a02b1e48c97 100644 (file)
@@ -906,10 +906,8 @@ struct lu_env *cl_env_nested_get(struct cl_env_nest *nest)
        if (env != NULL) {
                if (!cl_io_is_going(env))
                        return env;
-               else {
-                       cl_env_put(env, &nest->cen_refcheck);
-                       nest->cen_cookie = cl_env_reenter();
-               }
+               cl_env_put(env, &nest->cen_refcheck);
+               nest->cen_cookie = cl_env_reenter();
        }
        env = cl_env_get(&nest->cen_refcheck);
        if (IS_ERR(env)) {
index c8f6ab006124f742f933fdc661b5a272c2e86c8e..48dbbcf977020d150a6898f8bcd734b3c1718d4d 100644 (file)
@@ -279,9 +279,8 @@ static struct llog_handle *llog_cat_current_log(struct llog_handle *cathandle,
                    loghandle->lgh_last_idx < LLOG_BITMAP_SIZE(llh) - 1) {
                        up_read(&cathandle->lgh_lock);
                        return loghandle;
-               } else {
-                       up_write(&loghandle->lgh_lock);
                }
+               up_write(&loghandle->lgh_lock);
        }
        up_read(&cathandle->lgh_lock);
 
@@ -299,9 +298,8 @@ static struct llog_handle *llog_cat_current_log(struct llog_handle *cathandle,
                if (loghandle->lgh_last_idx < LLOG_BITMAP_SIZE(llh) - 1) {
                        up_write(&cathandle->lgh_lock);
                        return loghandle;
-               } else {
-                       up_write(&loghandle->lgh_lock);
                }
+               up_write(&loghandle->lgh_lock);
        }
 
        CDEBUG(D_INODE, "use next log\n");
index 06837f5f4e64a77395a6d1dba729f042e663374d..70b1b43f692b0231a2c16121ed9e7ee3caf8f327 100644 (file)
@@ -1176,8 +1176,7 @@ static int osc_lock_wait(const struct lu_env *env,
                                /* It is from enqueue RPC reply upcall for
                                 * updating state. Do not re-enqueue. */
                                return -ENAVAIL;
-                       else
-                               olck->ols_state = OLS_NEW;
+                       olck->ols_state = OLS_NEW;
                } else {
                        LASSERT(lock->cll_error);
                        return lock->cll_error;
index c174de9fb309f7724e09c9d126c6af35fe30ea6e..f84b4c78a8a0a3f3ef8f2351115225e2f948ddd9 100644 (file)
@@ -1007,8 +1007,8 @@ static int osc_should_shrink_grant(struct client_obd *client)
                if (client->cl_import->imp_state == LUSTRE_IMP_FULL &&
                    client->cl_avail_grant > brw_size)
                        return 1;
-               else
-                       osc_update_next_shrink(client);
+
+               osc_update_next_shrink(client);
        }
        return 0;
 }
@@ -2299,7 +2299,9 @@ int osc_enqueue_base(struct obd_export *exp, struct ldlm_res_id *res_id,
                        ldlm_lock_decref(lockh, mode);
                        LDLM_LOCK_PUT(matched);
                        return -ECANCELED;
-               } else if (osc_set_lock_data_with_check(matched, einfo)) {
+               }
+
+               if (osc_set_lock_data_with_check(matched, einfo)) {
                        *flags |= LDLM_FL_LVB_READY;
                        /* addref the lock only if not async requests and PW
                         * lock is matched whereas we asked for PR. */
@@ -2324,10 +2326,10 @@ int osc_enqueue_base(struct obd_export *exp, struct ldlm_res_id *res_id,
                                ldlm_lock_decref(lockh, einfo->ei_mode);
                        LDLM_LOCK_PUT(matched);
                        return ELDLM_OK;
-               } else {
-                       ldlm_lock_decref(lockh, mode);
-                       LDLM_LOCK_PUT(matched);
                }
+
+               ldlm_lock_decref(lockh, mode);
+               LDLM_LOCK_PUT(matched);
        }
 
  no_match:
index 61e33be865b2775c51b1b69619d3168561a9f436..d05c37c1fd30f3636185a3770e5d320aae1f4983 100644 (file)
@@ -289,12 +289,10 @@ static int ptlrpc_pinger_main(void *arg)
                                     thread_is_stopping(thread) ||
                                     thread_is_event(thread),
                                     &lwi);
-                       if (thread_test_and_clear_flags(thread, SVC_STOPPING)) {
+                       if (thread_test_and_clear_flags(thread, SVC_STOPPING))
                                break;
-                       } else {
-                               /* woken after adding import to reset timer */
-                               thread_test_and_clear_flags(thread, SVC_EVENT);
-                       }
+                       /* woken after adding import to reset timer */
+                       thread_test_and_clear_flags(thread, SVC_EVENT);
                }
        }