From 83fedb85505f2da7d34f7140e170ba52759e705b Mon Sep 17 00:00:00 2001 From: Henri Doreau Date: Wed, 3 Dec 2014 14:51:36 +0100 Subject: [PATCH] LU-4189 mdc: Removed unneeded NULL check Do not bother checking the return value of changelog_kuc_hdr() against NULL since this value was dereferenced earlier. Signed-off-by: Henri Doreau Change-Id: I34a81e840838e3b50bca0099fb810815b540875e Reviewed-on: http://review.whamcloud.com/12919 Tested-by: Maloo Reviewed-by: John L. Hammond Reviewed-by: Faccini Bruno Reviewed-by: Oleg Drokin --- lustre/mdc/mdc_request.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/lustre/mdc/mdc_request.c b/lustre/mdc/mdc_request.c index 3946940..fa1900e 100644 --- a/lustre/mdc/mdc_request.c +++ b/lustre/mdc/mdc_request.c @@ -1952,10 +1952,10 @@ static int mdc_changelog_send_thread(void *csdata) if (cs->cs_buf == NULL) GOTO(out, rc = -ENOMEM); - /* Set up the remote catalog handle */ - ctxt = llog_get_context(cs->cs_obd, LLOG_CHANGELOG_REPL_CTXT); - if (ctxt == NULL) - GOTO(out, rc = -ENOENT); + /* Set up the remote catalog handle */ + ctxt = llog_get_context(cs->cs_obd, LLOG_CHANGELOG_REPL_CTXT); + if (ctxt == NULL) + GOTO(out, rc = -ENOENT); rc = llog_open(NULL, ctxt, &llh, NULL, CHANGELOG_CATALOG, LLOG_OPEN_EXISTS); if (rc) { @@ -1975,19 +1975,17 @@ static int mdc_changelog_send_thread(void *csdata) rc = llog_cat_process(NULL, llh, changelog_kkuc_cb, cs, 0, 0); - /* Send EOF no matter what our result */ - if ((kuch = changelog_kuc_hdr(cs->cs_buf, sizeof(*kuch), - cs->cs_flags))) { - kuch->kuc_msgtype = CL_EOF; - libcfs_kkuc_msg_put(cs->cs_fp, kuch); - } + /* Send EOF no matter what our result */ + kuch = changelog_kuc_hdr(cs->cs_buf, sizeof(*kuch), cs->cs_flags); + kuch->kuc_msgtype = CL_EOF; + libcfs_kkuc_msg_put(cs->cs_fp, kuch); out: fput(cs->cs_fp); if (llh) llog_cat_close(NULL, llh); - if (ctxt) - llog_ctxt_put(ctxt); + if (ctxt) + llog_ctxt_put(ctxt); if (cs->cs_buf) OBD_FREE(cs->cs_buf, KUC_CHANGELOG_MSG_MAXSIZE); OBD_FREE_PTR(cs); -- 1.8.3.1