From patchwork Fri Apr 19 05:13:44 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yongjun X-Patchwork-Id: 2463121 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id A7464DF25A for ; Fri, 19 Apr 2013 05:13:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751072Ab3DSFNq (ORCPT ); Fri, 19 Apr 2013 01:13:46 -0400 Received: from mail-bk0-f42.google.com ([209.85.214.42]:51006 "EHLO mail-bk0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750951Ab3DSFNq (ORCPT ); Fri, 19 Apr 2013 01:13:46 -0400 Received: by mail-bk0-f42.google.com with SMTP id jc3so1560126bkc.29 for ; Thu, 18 Apr 2013 22:13:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:date:message-id:subject:from:to:cc :content-type; bh=ONlD/HLYZb0E/auZclJ1o/hvzezDG2QpmuLsMpb5dCA=; b=vwtF9T8DxV4wv//ysRudoITxTU0cd1k+yZiMfDj5+LlREnpDyFbI4TWM9LNlsRS0dj u+frCj5UtHmhBUwfdqax7/7oMuiRutsuegJ1DweP/MLG/2zZFoHFkzbvUmla6Ca4QvCT Os+bfjLcBcPyun1qJTPncngRb4IzhMTBu7tqCZeGTx2On6cSVWNHftU8IBhNc1JIoVYI ZdJEK3k1bnx/0VzeI+xdxgDnblL9sv2wFwyoF7R8Nnm4K9B1zoc7VdytXbvl6IKLh532 29hKqhmflEWY4lPx5BOES7GZlC8+MZsjGs+6Le6a30joI15R7qLwopmXjD94ULyjd+4i INLw== MIME-Version: 1.0 X-Received: by 10.204.62.9 with SMTP id v9mr3720027bkh.38.1366348424946; Thu, 18 Apr 2013 22:13:44 -0700 (PDT) Received: by 10.204.0.74 with HTTP; Thu, 18 Apr 2013 22:13:44 -0700 (PDT) Date: Fri, 19 Apr 2013 13:13:44 +0800 Message-ID: Subject: [PATCH -next] iser-target: fix error return code in isert_connect_request() From: Wei Yongjun To: roland@kernel.org, sean.hefty@intel.com, hal.rosenstock@gmail.com, nab@linux-iscsi.org Cc: yongjun_wei@trendmicro.com.cn, linux-rdma@vger.kernel.org Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org From: Wei Yongjun Fix to return a negative error code from the error handling case instead of 0, as done elsewhere in this function. Signed-off-by: Wei Yongjun --- drivers/infiniband/ulp/isert/ib_isert.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 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/isert/ib_isert.c b/drivers/infiniband/ulp/isert/ib_isert.c index f6f4f58..803b949 100644 --- a/drivers/infiniband/ulp/isert/ib_isert.c +++ b/drivers/infiniband/ulp/isert/ib_isert.c @@ -329,6 +329,7 @@ static struct isert_device * isert_device_find_by_ib_dev(struct rdma_cm_id *cma_id) { struct isert_device *device; + int ret; mutex_lock(&device_list_mutex); list_for_each_entry(device, &device_list, dev_node) { @@ -342,16 +343,17 @@ isert_device_find_by_ib_dev(struct rdma_cm_id *cma_id) device = kzalloc(sizeof(struct isert_device), GFP_KERNEL); if (!device) { mutex_unlock(&device_list_mutex); - return NULL; + return ERR_PTR(-ENOMEM); } INIT_LIST_HEAD(&device->dev_node); device->ib_device = cma_id->device; - if (isert_create_device_ib_res(device)) { + ret = isert_create_device_ib_res(device); + if (ret) { kfree(device); mutex_unlock(&device_list_mutex); - return NULL; + return ERR_PTR(ret); } device->refcount++; @@ -434,8 +436,10 @@ isert_connect_request(struct rdma_cm_id *cma_id, struct rdma_cm_event *event) } device = isert_device_find_by_ib_dev(cma_id); - if (!device) + if (IS_ERR(device)) { + ret = PTR_ERR(device); goto out_rsp_dma_map; + } isert_conn->conn_device = device; isert_conn->conn_pd = device->dev_pd;