From patchwork Tue Dec 2 10:26:19 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eli Cohen X-Patchwork-Id: 5419171 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 29D16BEEA8 for ; Tue, 2 Dec 2014 10:27:09 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C03312028D for ; Tue, 2 Dec 2014 10:27:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F3F622027D for ; Tue, 2 Dec 2014 10:27:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932088AbaLBK1B (ORCPT ); Tue, 2 Dec 2014 05:27:01 -0500 Received: from mail-wg0-f44.google.com ([74.125.82.44]:47821 "EHLO mail-wg0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754485AbaLBK0x (ORCPT ); Tue, 2 Dec 2014 05:26:53 -0500 Received: by mail-wg0-f44.google.com with SMTP id b13so16594196wgh.17 for ; Tue, 02 Dec 2014 02:26:52 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=sF9awznal0I2cO8hG9i+mMo/zis6s2Zy48bQNWKJBug=; b=VEnb1UzVGXVSryST8J2u3xMVI4ex2EPKmBWl5Kv8kotNlEcf3hophcn6LfKAGg0/SQ OdVpqmCQnN9MmkP8ehxKLk0iHhDohn/p3VN1azV/1I2xyZZAQXGDk6S36cADAY7ag7Fy Md0DD0Z4+r/1HU3Ad3hIPYBQTkqO+ZnLQ2J27VoxOUgTa/Cd5nWtHBXxK5FoKEeUwBgQ Qw4zjLUVV2svO74NSHZvh7JNxLxVI9KMs6XDJOmUSCI/I/TWpQfBywJCxt6HtEKDRc0a Qt5CO1kWL6W+tAtqaZYJh7kcG/jfS+nPqe0txjxoKmqMvyWYQCxR6wqW3f6RmgdUjUGP klXg== X-Gm-Message-State: ALoCoQk9dz1bE8Z1W8T4+dhwvFIukM2WSh11EJ9DHXqjpYNRFS+Ge3DWXQlxXSy+YbxpSm1crF5J X-Received: by 10.180.73.175 with SMTP id m15mr4133860wiv.0.1417516011909; Tue, 02 Dec 2014 02:26:51 -0800 (PST) Received: from localhost (out.voltaire.com. [193.47.165.251]) by mx.google.com with ESMTPSA id p1sm31306316wjy.22.2014.12.02.02.26.51 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 02 Dec 2014 02:26:51 -0800 (PST) From: Eli Cohen X-Google-Original-From: Eli Cohen To: davem@davemloft.net Cc: roland@kernel.org, linux-rdma@vger.kernel.org, netdev@vger.kernel.org, ogerlitz@mellanox.com, amirv@mellanox.com, Eli Cohen Subject: [PATCH net-next 9/9] mlx5: Fix error flow in add_keys Date: Tue, 2 Dec 2014 12:26:19 +0200 Message-Id: <1417515979-22418-10-git-send-email-eli@mellanox.com> X-Mailer: git-send-email 2.1.3 In-Reply-To: <1417515979-22418-1-git-send-email-eli@mellanox.com> References: <1417515979-22418-1-git-send-email-eli@mellanox.com> 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=ham 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 If mlx5_core_create_mkey fails, decrease the pending counter to undo the previous increment. Signed-off-by: Eli Cohen --- drivers/infiniband/hw/mlx5/mr.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/infiniband/hw/mlx5/mr.c b/drivers/infiniband/hw/mlx5/mr.c index 4c89b64aa9cf..5a80dd993761 100644 --- a/drivers/infiniband/hw/mlx5/mr.c +++ b/drivers/infiniband/hw/mlx5/mr.c @@ -159,6 +159,9 @@ static int add_keys(struct mlx5_ib_dev *dev, int c, int num) sizeof(*in), reg_mr_callback, mr, &mr->out); if (err) { + spin_lock_irq(&ent->lock); + ent->pending--; + spin_unlock_irq(&ent->lock); mlx5_ib_warn(dev, "create mkey failed %d\n", err); kfree(mr); break;