Received: by 10.223.164.202 with SMTP id h10csp1815991wrb; Mon, 27 Nov 2017 07:51:10 -0800 (PST) X-Google-Smtp-Source: AGs4zMaPO3kj98qYyfYx4Wqjt2JHsOLuh+iH9DE7gpio/54gbsdLmdMjt0L1oaiUSDtEhoYCRixn X-Received: by 10.84.197.3 with SMTP id m3mr30238428pld.264.1511797870777; Mon, 27 Nov 2017 07:51:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511797870; cv=none; d=google.com; s=arc-20160816; b=T3mRLN7Ju6/vtSl1ONCm6g05bFMQ6UR6/lx98hxC9EgvVF7WqYn9JZRXi46rTOW1Oc /+ex0dXg4facwMrK3YNw1mDWiC+hh0EF8oTZbtnAuuHFKwai8Sn6iLuQJZaj4qBRJn+8 tiSChFHPuFZWIDgumpBfWQyuYXmp5tg7gVLrIkAQ4YBuLCrnbwHh6L5Z8vOAweQ90t+j Y3FzcQ4NPCAwlbEv5d8wvEGLp2dsgRj2vCpX03DDtGrsgG2/E40Ndfr3l3OBlDmaRxT5 +R8+17M1s9QcN4wOrrdEfI1KevkWaN8/DbNMhqjvFG/uNdeEwyfLZLyP3QcvQXgSQeIX pSmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=fs/n/YJD5oqLAqndAfS8LSE2/DLvb/Zwti7O4ffDa/I=; b=fpEsQgUVU1/AHMcLk2pPnuMGzvD1NOxrFtzrTo0BpkUBIsfybpR9JFwkD1zZ45Vtq9 DBFGGd5ELnqDqqv1DE8TlivPmtCEaojl2uJJHOreTHF18htajfh4h2FG82yfi7HQLKTd onEQU0BY2eys64NY+vSJY9HlUkOZLAnLLk6GN48HcSpH6yTBveoMFcjq4d6SWBt5DRLQ 7VLT0izDGp8v8PC9zWJbmFLhjuvYJe9bpr7RKaqWsvksDGbkt5+opODpg5KT6x9cq46C aHCyhnV8Ww/EHk0MI5npM6LAaGBkRmCo3r77dJWNVgEHm57XiCHCeLC9a01+NII/9rft Gt6g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e190si25370274pfe.93.2017.11.27.07.50.59; Mon, 27 Nov 2017 07:51:10 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752890AbdK0PuO (ORCPT + 78 others); Mon, 27 Nov 2017 10:50:14 -0500 Received: from bastet.se.axis.com ([195.60.68.11]:40322 "EHLO bastet.se.axis.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752663AbdK0PuI (ORCPT ); Mon, 27 Nov 2017 10:50:08 -0500 Received: from localhost (localhost [127.0.0.1]) by bastet.se.axis.com (Postfix) with ESMTP id 04D641830E; Mon, 27 Nov 2017 16:50:07 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at bastet.se.axis.com Received: from bastet.se.axis.com ([IPv6:::ffff:127.0.0.1]) by localhost (bastet.se.axis.com [::ffff:127.0.0.1]) (amavisd-new, port 10024) with LMTP id 0yMa1IBcbK3h; Mon, 27 Nov 2017 16:50:05 +0100 (CET) Received: from boulder03.se.axis.com (boulder03.se.axis.com [10.0.8.17]) by bastet.se.axis.com (Postfix) with ESMTPS id 207B818330; Mon, 27 Nov 2017 16:50:05 +0100 (CET) Received: from boulder03.se.axis.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DD4B81E092; Mon, 27 Nov 2017 16:50:04 +0100 (CET) Received: from boulder03.se.axis.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D0AF41E080; Mon, 27 Nov 2017 16:50:04 +0100 (CET) Received: from thoth.se.axis.com (unknown [10.0.2.173]) by boulder03.se.axis.com (Postfix) with ESMTP; Mon, 27 Nov 2017 16:50:04 +0100 (CET) Received: from lnxartpec1.se.axis.com (lnxartpec1.se.axis.com [10.88.4.10]) by thoth.se.axis.com (Postfix) with ESMTP id C3FD71B73; Mon, 27 Nov 2017 16:50:04 +0100 (CET) Received: by lnxartpec1.se.axis.com (Postfix, from userid 20283) id C019840102; Mon, 27 Nov 2017 16:50:04 +0100 (CET) From: Niklas Cassel To: Kishon Vijay Abraham I , Lorenzo Pieralisi , Bjorn Helgaas Cc: Niklas Cassel , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 2/3] PCI: endpoint: Fix error handling in pci_epc_epf_link() Date: Mon, 27 Nov 2017 16:49:54 +0100 Message-Id: <20171127154955.22214-3-niklas.cassel@axis.com> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171127154955.22214-1-niklas.cassel@axis.com> References: <20171127154955.22214-1-niklas.cassel@axis.com> X-TM-AS-GCONF: 00 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The error handling in pci_epc_epf_link() was broken, since the clean up code for pci_epc_add_epf() did clear_bit(), even though the matching set_bit() is done after pci_epc_add_epf(). Also, clear_bit() should be done before pci_epc_remove_epf(), since clean up code should normally do things in the reverse order. Fixes: d74679911610 ("PCI: endpoint: Introduce configfs entry for configuring EP functions") Signed-off-by: Niklas Cassel --- drivers/pci/endpoint/pci-ep-cfs.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/pci/endpoint/pci-ep-cfs.c b/drivers/pci/endpoint/pci-ep-cfs.c index 4f74386c1ced..e1f5adc9e113 100644 --- a/drivers/pci/endpoint/pci-ep-cfs.c +++ b/drivers/pci/endpoint/pci-ep-cfs.c @@ -106,7 +106,7 @@ static int pci_epc_epf_link(struct config_item *epc_item, epf = epf_group->epf; ret = pci_epc_add_epf(epc, epf); if (ret) - goto err_add_epf; + return ret; func_no = find_first_zero_bit(&epc_group->function_num_map, sizeof(epc_group->function_num_map)); @@ -120,10 +120,8 @@ static int pci_epc_epf_link(struct config_item *epc_item, return 0; err_epf_bind: - pci_epc_remove_epf(epc, epf); - -err_add_epf: clear_bit(func_no, &epc_group->function_num_map); + pci_epc_remove_epf(epc, epf); return ret; } -- 2.14.2 From 1585218913179765076@xxx Mon Nov 27 11:36:03 +0000 2017 X-GM-THRID: 1583608276010403047 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread