From patchwork Sat Nov 22 14:39:18 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julia Lawall X-Patchwork-Id: 5359351 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 2B26CC11AC for ; Sat, 22 Nov 2014 14:45:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5D8A12011E for ; Sat, 22 Nov 2014 14:45:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 887C52010C for ; Sat, 22 Nov 2014 14:45:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752169AbaKVOoy (ORCPT ); Sat, 22 Nov 2014 09:44:54 -0500 Received: from mail3-relais-sop.national.inria.fr ([192.134.164.104]:54078 "EHLO mail3-relais-sop.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752105AbaKVOon (ORCPT ); Sat, 22 Nov 2014 09:44:43 -0500 X-IronPort-AV: E=Sophos;i="5.07,437,1413237600"; d="scan'208";a="90017240" Received: from palace.rsr.lip6.fr (HELO localhost.localdomain) ([132.227.105.202]) by mail3-relais-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 22 Nov 2014 15:44:17 +0100 From: Julia Lawall To: Roland Dreier Cc: kernel-janitors@vger.kernel.org, Sean Hefty , Hal Rosenstock , linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 5/6] ib_srpt: fix error return code Date: Sat, 22 Nov 2014 15:39:18 +0100 Message-Id: <1416667159-9808-6-git-send-email-Julia.Lawall@lip6.fr> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1416667159-9808-1-git-send-email-Julia.Lawall@lip6.fr> References: <1416667159-9808-1-git-send-email-Julia.Lawall@lip6.fr> Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Julia Lawall Return a negative error code on failure. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @@ identifier ret; expression e1,e2; @@ ( if (\(ret < 0\|ret != 0\)) { ... return ret; } | ret = 0 ) ... when != ret = e1 when != &ret *if(...) { ... when != ret = e2 when forall return ret; } // Signed-off-by: Julia Lawall Reviewed-by: Bart Van Assche --- drivers/infiniband/ulp/srpt/ib_srpt.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c index 7206547..cbfdce7 100644 --- a/drivers/infiniband/ulp/srpt/ib_srpt.c +++ b/drivers/infiniband/ulp/srpt/ib_srpt.c @@ -2135,8 +2135,8 @@ static int srpt_create_ch_ib(struct srpt_rdma_ch *ch) ch->thread = kthread_run(srpt_compl_thread, ch, "ib_srpt_compl"); if (IS_ERR(ch->thread)) { - printk(KERN_ERR "failed to create kernel thread %ld\n", - PTR_ERR(ch->thread)); + ret = PTR_ERR(ch->thread); + printk(KERN_ERR "failed to create kernel thread %ld\n", ret); ch->thread = NULL; goto err_destroy_qp; } @@ -2580,6 +2580,7 @@ static int srpt_cm_req_recv(struct ib_cm_id *cm_id, if (!nacl) { printk(KERN_INFO "Rejected login because no ACL has been" " configured yet for initiator %s.\n", ch->sess_name); + ret = -EINVAL; rej->reason = __constant_cpu_to_be32( SRP_LOGIN_REJ_CHANNEL_LIMIT_REACHED); goto destroy_ib; @@ -2590,6 +2591,7 @@ static int srpt_cm_req_recv(struct ib_cm_id *cm_id, rej->reason = __constant_cpu_to_be32( SRP_LOGIN_REJ_INSUFFICIENT_RESOURCES); pr_debug("Failed to create session\n"); + ret = PTR_ERR(ch->sess); goto deregister_session; } ch->sess->se_node_acl = &nacl->nacl;